Skip to content

bgrainger/RomuRandom

Repository files navigation

RomuRandom

RomuRandom is a .NET implementation of the Romu family of random number generators.

Build Status NuGet

Usage

Use RomuRandom as a drop-in replacement for System.Random:

System.Random random = new RomuRandom(); // seeded with current time
var randomNumber = random.Next();
var dieRoll = random.Next(6); // from 0-5
var randomInRange = random.Next(100, 200); // from 100-199

var bytes = new byte[100];
random.NextBytes(bytes); // fill array with random bytes

Advanced

The RomuDuo, RomuTrio, and RomuQuad classes can be instantiated directly (for higher performance, or more control over the seed values).

Note that they only return a random ulong value in the range [0, UInt64.MaxValue]. This needs to be converted carefully if you want to get a random number in a smaller range without bias.

License

Licensed under the Apache License, Version 2.0.

About

.NET implementation of Romu random number generators

Topics

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages