RandomString4Net 1.5.0

Additional Details

Please use the latest version

There is a newer version of this package available.
See the version list below for details.
dotnet add package RandomString4Net --version 1.5.0
NuGet\Install-Package RandomString4Net -Version 1.5.0
This command is intended to be used within the Package Manager Console in Visual Studio, as it uses the NuGet module's version of Install-Package.
<PackageReference Include="RandomString4Net" Version="1.5.0" />
For projects that support PackageReference, copy this XML node into the project file to reference the package.
paket add RandomString4Net --version 1.5.0
#r "nuget: RandomString4Net, 1.5.0"
#r directive can be used in F# Interactive and Polyglot Notebooks. Copy this into the interactive tool or source code of the script to reference the package.
// Install RandomString4Net as a Cake Addin
#addin nuget:?package=RandomString4Net&version=1.5.0

// Install RandomString4Net as a Cake Tool
#tool nuget:?package=RandomString4Net&version=1.5.0

RandomString4Net

Version 1.5.0

Author : Lakhya Jyoti Nath (ljnath)<br> Date : September 2020 - December 2022 - January 2023<br> Email : ljnath@ljnath.com<br> Website : https://www.ljnath.com

Nuget Nuget GitHub Workflow Status GitHub

Introduction

RandomString4Net is a library developed in .NET Framework to generate N random strings of M length from various categories. It is fast and suports string generation of various length.<br><br> It is parameterized to generate both a single or a list of random strings.<br> Random strings can be of types alphabet and alphanumeric supporting all the cases viz. lower, upper and mixed.<br> It also supports symbol during the random string generation process. Following are the list of supported symbols <br> !#$%&'()*+,-./:;<=>?@[]^_`{|}~"

It also allows you to generate random string with only a subset of symbols from the above supported list. It is an ideal use for project like

  • password generator
  • mobile number generator
  • unique-id generator
  • unique filename generator
  • raw data generator for data processing/parsing projects
  • fake name generator etc. etc.

Features

  • Supports single or multiple random string generation
  • Supports random string generation from alphabet, numbers, symbols or a combination of them
  • Supports customized length of randon string
  • Supports random length of generated strings with a fixed max length
  • Supports true unique random number generation (v1.3.0)
  • Built with compilation conditions to take advantage of newer .NET Framework functionalities
  • Improved performance in newer .NET Framework ( >2.0)
  • Added support to force include strings of each type (version 1.4.0)

Supported Types

  • NUMBER : 0123456789
  • SYMBOLS : !#$%&'()*+,-./:;<=>?@[]^_`{|}~"
  • ALPHABET_LOWERCASE : abcdefghijklmnopqrstuvwxyz
  • ALPHABET_UPPERCASE : ABCDEFGHIJKLMNOPQRSTUVWXYZ
  • ALPHABET_MIXEDCASE : abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ
  • ALPHANUMERIC_LOWERCASE : abcdefghijklmnopqrstuvwxyz0123456789
  • ALPHANUMERIC_UPPERCASE : ABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789
  • ALPHANUMERIC_MIXEDCASE : abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789
  • ALPHABET_LOWERCASE_WITH_SYMBOLS : abcdefghijklmnopqrstuvwxyz!#$%&'()*+,-./:;<=>?@[]^_`{|}~"
  • ALPHABET_UPPERCASE_WITH_SYMBOLS : ABCDEFGHIJKLMNOPQRSTUVWXYZ!#$%&'()*+,-./:;<=>?@[]^_`{|}~"
  • ALPHABET_MIXEDCASE_WITH_SYMBOLS : abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ!#$%&'()*+,-./:;<=>?@[]^_`{|}~"
  • ALPHANUMERIC_LOWERCASE_WITH_SYMBOLS : abcdefghijklmnopqrstuvwxyz0123456789!#$%&'()*+,-./:;<=>?@[]^_`{|}~"
  • ALPHANUMERIC_UPPERCASE_WITH_SYMBOLS : ABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789!#$%&'()*+,-./:;<=>?@[]^_`{|}~"
  • ALPHANUMERIC_MIXEDCASE_WITH_SYMBOLS : abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789" !#$%&'()*+,-./:;<=>?@[]^_`{|}~"

Get Started

1. Install Package

PM> Install-Package RandomString4Net

2. Add reference in your project

3. Call the methods in your program

using RandomString4Net;

namespace RandomString4NetTester
{
    public void Main()
    {
        // generating one random string from lowercase alphabets
        string randomString = RandomString.GetString(Types.ALPHABET_LOWERCASE);
        System.Console.WriteLine(randomString);

        // generating 100 random string from all mixedcase alphabet, numbers and all supported symbols
        List<string> randomAlphaNumbericStrings = RandomString.GetStrings(Types.ALPHANUMERIC_MIXEDCASE_WITH_SYMBOLS, 100);
        foreach (string s in randomAlphaNumbericStrings)
            System.Console.WriteLine(s);

        // generating 200 random string from uppercase alphabet with custom symbols
        List<string> randomAlphabetWithCustomSymbols = RandomString.GetStrings(Types.ALPHABET_UPPERCASE, 200, "/+*-");
        foreach (string s in randomAlphabetWithCustomSymbols)
            System.Console.WriteLine(s);

        // generating 1000 true random strings of length 20 from uppercase alphabet with custom symbols
        List<string> trueUniqueRandomStrings = RandomString.GetStrings(Types.ALPHABET_UPPERCASE, 1000, 20, false, true);
        foreach (string s in trueUniqueRandomStrings)
            System.Console.WriteLine(s);

        // generating 100 random string of mixedcase alphanummeric with custom symbols
        List<string> randomAlphabetWithCustomSymbols = RandomString.GetStrings(Types.ALPHANUMERIC_MIXEDCASE_WITH_SYMBOLS, 100, "/+*-", forceOccuranceOfEachType: true);
        foreach (string s in randomAlphabetWithCustomSymbols)
            System.Console.WriteLine(s);
    }
}

Give a Star! ⭐️

If you find this repository useful, please give it a star. Thanks in advance !

License

Copyright © 2023 Lakhya's Innovation Inc. under the MIT License.

Product Compatible and additional computed target framework versions.
.NET Framework net20 is compatible.  net35 is compatible.  net40 is compatible.  net403 was computed.  net45 is compatible.  net451 is compatible.  net452 is compatible.  net46 is compatible.  net461 is compatible.  net462 is compatible.  net463 was computed.  net47 is compatible.  net471 is compatible.  net472 is compatible.  net48 is compatible.  net481 was computed. 
Compatible target framework(s)
Included target framework(s) (in package)
Learn more about Target Frameworks and .NET Standard.
  • .NETFramework 2.0

    • No dependencies.
  • .NETFramework 3.5

    • No dependencies.
  • .NETFramework 4.0

    • No dependencies.
  • .NETFramework 4.5

    • No dependencies.
  • .NETFramework 4.5.1

    • No dependencies.
  • .NETFramework 4.5.2

    • No dependencies.
  • .NETFramework 4.6

    • No dependencies.
  • .NETFramework 4.6.1

    • No dependencies.
  • .NETFramework 4.6.2

    • No dependencies.
  • .NETFramework 4.7

    • No dependencies.
  • .NETFramework 4.7.1

    • No dependencies.
  • .NETFramework 4.7.2

    • No dependencies.
  • .NETFramework 4.8

    • No dependencies.

NuGet packages

This package is not used by any NuGet packages.

GitHub repositories

This package is not used by any popular GitHub repositories.

Version Downloads Last updated
1.8.0 9,565 11/15/2023
1.7.0 2,606 11/1/2023
1.6.0 120 10/29/2023
1.5.0 2,841 1/9/2023
1.4.0 541 12/5/2022
1.3.0 6,575 9/22/2020
1.2.0 703 9/20/2020
1.1.0 691 9/20/2020
1.0.0 603 9/20/2020

- Initial release with support for alphabet, alphanumeric with any without symbols for all cases
- Added support for random number generation
- Added support for multiple .NET Framework
- Added support to generate true unique random numbers
- Added performance improvement for .NET Framework > 2.0
- Added support to generate random strings by including strings of each type