GenLetterByFreqNet 4.0.1

dotnet add package GenLetterByFreqNet --version 4.0.1
                    
NuGet\Install-Package GenLetterByFreqNet -Version 4.0.1
                    
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="GenLetterByFreqNet" Version="4.0.1" />
                    
For projects that support PackageReference, copy this XML node into the project file to reference the package.
<PackageVersion Include="GenLetterByFreqNet" Version="4.0.1" />
                    
Directory.Packages.props
<PackageReference Include="GenLetterByFreqNet" />
                    
Project file
For projects that support Central Package Management (CPM), copy this XML node into the solution Directory.Packages.props file to version the package.
paket add GenLetterByFreqNet --version 4.0.1
                    
#r "nuget: GenLetterByFreqNet, 4.0.1"
                    
#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.
#:package GenLetterByFreqNet@4.0.1
                    
#:package directive can be used in C# file-based apps starting in .NET 10 preview 4. Copy this into a .cs file before any lines of code to reference the package.
#addin nuget:?package=GenLetterByFreqNet&version=4.0.1
                    
Install as a Cake Addin
#tool nuget:?package=GenLetterByFreqNet&version=4.0.1
                    
Install as a Cake Tool

ABOUT:

  • GenLetterByFreqNet generates random characters. The odds of how likely a character will be generated are based on weighted percent values. With this library, you can easily generate random characters while fine-tuning the chances of specific characters appearing.
  • By default, this library randomly generates characters (a–z) based on how frequently the characters are used in the Oxford English Dictionary. So commonly used letters like 'e' are much more likely to be randomly generated compared to rarer letters like 'z'. The data behind these percentage weights can be found here: https://www3.nd.edu/~busiforc/handouts/cryptography/letterfrequencies.html
  • The user also has the option to fine-tune odds by overriding the default a–z character table by providing a custom dictionary, where each key is a character and the key's corresponding value represents the percentage likelihood of that character being randomly generated.

GET STARTED:

  • To use default (a-z) values and their corresponding weight percentages based on how frequently the characters are used in the Oxford Dictionary, simply create a CharGenerator instance with no constructor args:
 CharGenerator OxfordLetterGenerator = new CharGenerator();
  • To use a custom character list with custom frequency values, pass in a generic Dictionary. The key being a unique character and the value representing the likelihood of that character generating:
// Dictionary<char, double>: Each key is a character, and each value defines the probability of that character being generated.
CharGenerator CustomCharacterChartGenerator = new CharGenerator(new Dictionary<char, double> { {'4', 50}, {'k', 50} }); 
// This character generator will have a 50% chance of generating a '4' character and a 50% chance of generating a 'k' character

USE:

  • How to a generate random character:
//generates single character randomly
char randChar = OxfordLetterGenerator.GetRandomCharacter();
  • How to generate a random string:
int amount = 10;
//will generate 10 random characters
string randStr = OxfordLetterGenerator.GetRandomCharacters(amount); 

EXCEPTIONS:

  • InvalidCharacterAmountException: if GetRandomCharacters(int amount) method is called with a number less than or equal to 0.
  • InvalidWeightException: if a weight value in the custom dictionary that was passed into the CharGenerator constructor is too small (less than 0.00001).
  • ChartMappingFailureException: Unexpected error occurred during frequency chart building process.
  • InvalidDictException: If constructor dictionary parameter is empty or size is greater than 10,000.
Product Compatible and additional computed target framework versions.
.NET net7.0 is compatible.  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 was computed.  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 was computed.  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.  net10.0 was computed.  net10.0-android was computed.  net10.0-browser was computed.  net10.0-ios was computed.  net10.0-maccatalyst was computed.  net10.0-macos was computed.  net10.0-tvos was computed.  net10.0-windows was computed. 
Compatible target framework(s)
Included target framework(s) (in package)
Learn more about Target Frameworks and .NET Standard.
  • net7.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
4.0.1 222 4/6/2025
4.0.0 207 4/6/2025
3.0.0 195 4/4/2025
2.1.1 251 8/18/2024
2.0.1 222 8/18/2024
2.0.0 238 8/18/2024
1.0.0 281 7/24/2023 1.0.0 is deprecated because it is no longer maintained.