Skip to content

Latest commit

 

History

History
35 lines (24 loc) · 1.23 KB

File metadata and controls

35 lines (24 loc) · 1.23 KB

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.