/random-word-generator

A nuget package to generate random words

Primary LanguageC#MIT LicenseMIT

random-word-generator

nuget

Description

  • A random word generator for .NET and .NET Core
  • Useful for:
    • Username generation
    • Random word stories

Tests

.NET 6.0

.NET Core 3.1

Nuget Publish

Usage

Install Package:

dotnet add package CrypticWizard.RandomWordGenerator
<PackageReference Include="CrypticWizard.RandomWordGenerator" Version="0.9.5"/>

Include Package:

using CrypticWizard.RandomWordGenerator;
using static CrypticWizard.RandomWordGenerator.WordGenerator; //for brevity, not required

GetWord( )

WordGenerator myWordGenerator = new WordGenerator();
string word = myWordGenerator.GetWord(PartOfSpeech.noun);
jewel

GetWords( )

WordGenerator myWordGenerator = new WordGenerator();
List<string> advs = myWordGenerator.GetWords(PartOfSpeech.adv, 5);
abnormally
boastfully
daintily
shakily
surprisingly

IsWord ()

WordGenerator myWordGenerator = new WordGenerator();
bool isWord = myWordGenerator.IsWord("exemplary");
true

IsPartOfSpeech( )

WordGenerator myWordGenerator = new WordGenerator();
bool isPartOfSpeech = myWordGenerator.IsPartOfSpeech("ball", PartOfSpeech.noun);
true

GetPatterns( )

WordGenerator myWordGenerator = new WordGenerator();

List<PartOfSpeech> pattern = new List<PartOfSpeech>();
pattern.Add(PartOfSpeech.adv);
pattern.Add(PartOfSpeech.adj);
pattern.Add(PartOfSpeech.noun);

List<string> patterns = myWordGenerator.GetPatterns(pattern, ' ', 10);
clearly calm bandana
doubtfully majestic pizza
faithfully acidic bat
freely bustling earthquake
hastily corrupt cake
jealously poised harmony
lively golden lizard
mechanically foolish mitten
successfully spherical scooter
upbeat salty soldier

SetSeed( ) - thanks michaldivis!

WordGenerator myWordGenerator = new WordGenerator(seed:123456);
myWordGenerator.SetSeed(654321);

SetRandom( )

myWordGenerator.SetRandom(new Random(654321));
string word = myWordGenerator.GetWord(PartOfSpeech.noun);

Features

Recently Added

  • v0.9.4 - SetSeed()
  • v0.9.4 - SetRandom()
  • v0.9.3 - package prefix
  • v0.9.2 - IsWord()

Planned Features

  • Other languages are not planned but can be added as .txt files in a folder of the language abreviation
    • ES
    • FR
    • etc.

Tools

License