StuceSoftware.RandomStringGenerator
2.0.0-prerelease.10
See the version list below for details.
dotnet add package StuceSoftware.RandomStringGenerator --version 2.0.0-prerelease.10
NuGet\Install-Package StuceSoftware.RandomStringGenerator -Version 2.0.0-prerelease.10
<PackageReference Include="StuceSoftware.RandomStringGenerator" Version="2.0.0-prerelease.10" />
paket add StuceSoftware.RandomStringGenerator --version 2.0.0-prerelease.10
#r "nuget: StuceSoftware.RandomStringGenerator, 2.0.0-prerelease.10"
// Install StuceSoftware.RandomStringGenerator as a Cake Addin #addin nuget:?package=StuceSoftware.RandomStringGenerator&version=2.0.0-prerelease.10&prerelease // Install StuceSoftware.RandomStringGenerator as a Cake Tool #tool nuget:?package=StuceSoftware.RandomStringGenerator&version=2.0.0-prerelease.10&prerelease
StuceSoftware.RandomStringGenerator
Authors :
Jeff Shergalis
Lakhya Jyoti Nath (ljnath)
Date : September 2020 - October 2024
Introduction
StuceSoftware.RandomStringGenerator is a library developed in C# to generate random strings of from various categories.
It is fast and suports string generation of various length. It is parameterized to generate both a single or a list of random strings.
Random strings can be of types lowercase, uppercase, numbers and symbols. It also allows you to generate random string with only a
subset of symbols from the supported list. It is an ideal library for use in projects such as:
- password generator
- unique-id generator
- unique filename generator
- raw data generator for data processing/parsing projects
- *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 random string
- Supports random length of generated strings with a fixed max length
- Supports true unique random number generation
- Support force inclusion of strings of each type
- Supports .NET Standard 2.0 & 2.1, .NET 6.0, 8.0 & 9.0
Supported Types
- Lowercase : abcdefghijklmnopqrstuvwxyz
- Uppercase : ABCDEFGHIJKLMNOPQRSTUVWXYZ
- Numbers : 0123456789
- Symbols : !#$%&'()*+,-./:;<=>?@[]^_`{|}~"
These types are defined by an enum CharClasses
which has the [Flags]
attribue, making it easy to combine the different classes.
:rotating_light: Breaking Change 🚨
The switch to a [Flags]
enum is a breaking change in version 2.0
Get Started
1. Install Package
PM> Install-Package StuceSoftware.RandomStringGenerator
2. Add reference in your project
3. Call the methods in your program
using StuceSoftware.RandomStringGenerator;
// generating one random string from lowercase alphabets
var randomString = RandomString.GetString(CharClasses.Lowercase);
System.Console.WriteLine(randomString);
// generating 100 random string from all mixedcase alphabet, numbers and all supported symbols
var randomAlphaNumbericStrings = RandomString.GetStrings(CharClasses.Lowercase | CharClasses.Uppercase | CharClasses.Numbers | CharClasses.Symbols, 100);
foreach (string s in randomAlphaNumbericStrings)
System.Console.WriteLine(s);
// generating 200 random string from uppercase alphabet with custom symbols
var randomAlphabetWithCustomSymbols = RandomString.GetStrings(CharClasses.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
var trueUniqueRandomStrings = RandomString.GetStrings(CharClasses.Uppercase, 1000, 20, "/+*-", false, true);
foreach (string s in trueUniqueRandomStrings)
System.Console.WriteLine(s);
// generating 100 random string of mixedcase alphanummeric with custom symbols
var randomAlphabetWithCustomSymbols = RandomString.GetStrings(CharClasses.Lowercase | CharClasses.Uppercase | CharClasses.Numbers | CharClasses.Symbols, 100, "/+*-", forceOccuranceOfEachType: true);
foreach (string s in randomAlphabetWithCustomSymbols)
System.Console.WriteLine(s);
:eyes: Note
As of version 2.0, if custom symbols are defined, there is no need to specify the symbol character class (CharClasses.Symbols
),
this is assumed when custom symbols are provided
Give a Star! ⭐️
If you find this repository useful, please give it a star. Thanks in advance !
License
Copyright © 2024 Stuce Software Solutions under the MIT License.
Product | Versions Compatible and additional computed target framework versions. |
---|---|
.NET | net5.0 was computed. net5.0-windows was computed. net6.0 is compatible. net6.0-android was computed. net6.0-ios was computed. net6.0-maccatalyst was computed. net6.0-macos was computed. net6.0-tvos was computed. net6.0-windows was computed. net7.0 was computed. net7.0-android was computed. net7.0-ios was computed. net7.0-maccatalyst was computed. net7.0-macos was computed. net7.0-tvos was computed. net7.0-windows was computed. net8.0 is compatible. net8.0-android was computed. net8.0-browser was computed. net8.0-ios was computed. net8.0-maccatalyst was computed. net8.0-macos was computed. net8.0-tvos was computed. net8.0-windows was computed. net9.0 is compatible. net9.0-android was computed. net9.0-browser was computed. net9.0-ios was computed. net9.0-maccatalyst was computed. net9.0-macos was computed. net9.0-tvos was computed. net9.0-windows was computed. |
.NET Core | netcoreapp2.0 was computed. netcoreapp2.1 was computed. netcoreapp2.2 was computed. netcoreapp3.0 was computed. netcoreapp3.1 was computed. |
.NET Standard | netstandard2.0 is compatible. netstandard2.1 is compatible. |
.NET Framework | net461 was computed. net462 was computed. net463 was computed. net47 was computed. net471 was computed. net472 was computed. net48 was computed. net481 was computed. |
MonoAndroid | monoandroid was computed. |
MonoMac | monomac was computed. |
MonoTouch | monotouch was computed. |
Tizen | tizen40 was computed. tizen60 was computed. |
Xamarin.iOS | xamarinios was computed. |
Xamarin.Mac | xamarinmac was computed. |
Xamarin.TVOS | xamarintvos was computed. |
Xamarin.WatchOS | xamarinwatchos was computed. |
-
.NETStandard 2.0
- No dependencies.
-
.NETStandard 2.1
- No dependencies.
-
net6.0
- No dependencies.
-
net8.0
- No dependencies.
-
net9.0
- 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 |
---|---|---|
3.0.2-prerelease.18 | 34 | 2/11/2025 |
3.0.2-prerelease.17 | 31 | 1/20/2025 |
3.0.2-prerelease.16 | 29 | 1/20/2025 |
3.0.2-prerelease.15 | 54 | 10/29/2024 |
3.0.1 | 125 | 10/23/2024 |
3.0.0-prerelease.13 | 51 | 10/23/2024 |
3.0.0-prerelease.12 | 52 | 10/22/2024 |
2.0.0 | 108 | 10/4/2024 |
2.0.0-prerelease.10 | 52 | 10/4/2024 |
1.0.3-prerelease.9 | 56 | 10/4/2024 |
1.0.2 | 112 | 10/3/2024 |
1.0.2-prerelease.7 | 53 | 10/3/2024 |
1.0.1 | 108 | 10/2/2024 |
1.0.0-prerelease.5 | 52 | 10/2/2024 |
1.0.0-prerelease.4 | 50 | 10/2/2024 |
1.0.0-prerelease.3 | 52 | 10/2/2024 |
1.0.0-prerelease.1 | 56 | 10/2/2024 |
- Fixed issue with string generation where forceOccurrenceOfEachType did not guarantee at least one character from each grouping in the resultant string.