Thanks to visit codestin.com
Credit goes to github.com

Skip to content

EasyRandom for .Net is an assembly/ library to generate random numbers with the internal Random library from .Net more easy.

License

Notifications You must be signed in to change notification settings

SeppPenner/DotNetEasyRandom

Repository files navigation

DotNetEasyRandom

DotNetEasyRandom is an assembly/ library to generate random numbers with the internal Random library from .Net more easily.

Build status GitHub issues GitHub forks GitHub stars License: MIT Nuget NuGet Downloads Known Vulnerabilities Gitter Blogger Patreon PayPal

Available for

  • Net 8.0
  • Net 9.0

Net Core and Net Framework latest and LTS versions

Basic usage

public class ExampleUsage
{
    private readonly IEasyRandom _random = new EasyRandom(); //Normal construtor

    private readonly IEasyRandom _random2 = new EasyRandom(12); //Construtor with seed

    public void Test()
    {
        _random.Next(); //Function from the "normal" Random class
        _random.Next(12); //Function from the "normal" Random class
        _random.Next(1, 5, IncludeType.None); //Gives back 2, 3 or 4
        _random.Next(1, 5, IncludeType.StartOnly); //Gives back 1, 2, 3 or 4
        _random.Next(1, 5, IncludeType.EndOnly); //Gives back 2, 3, 4 or 5
        _random.Next(1, 5, IncludeType.Both); //Gives back 1, 2, 3, 4 or 5
        _random.NextBytes(new byte[] {1, 2, 3, 4}); //Function from the "normal" Random class
        _random.NextDouble(); //Function from the "normal" Random class
        _random.NextDoubleExcludedBoth(1.0, 2.0);
        //Gives back a double value between 1.0 and 2.0 EXCLUDING the borders
        //(e.g. from 1.0000000000000000000000000000000001 to 1.9999999999999999999999999999999999
    }
}

Install

dotnet add package HaemmerElectronics.SeppPenner.DotNetEasyRandom

Change history

See the Changelog.

About

EasyRandom for .Net is an assembly/ library to generate random numbers with the internal Random library from .Net more easy.

Resources

License

Stars

Watchers

Forks

Packages