Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/bgrainger/romurandom
.NET implementation of Romu random number generators
https://github.com/bgrainger/romurandom
csharp netcore netstandard prng random-number-generators romu
Last synced: 9 days ago
JSON representation
.NET implementation of Romu random number generators
- Host: GitHub
- URL: https://github.com/bgrainger/romurandom
- Owner: bgrainger
- License: apache-2.0
- Created: 2020-03-03T05:01:32.000Z (almost 5 years ago)
- Default Branch: master
- Last Pushed: 2020-03-06T06:41:20.000Z (almost 5 years ago)
- Last Synced: 2024-12-13T03:51:54.305Z (27 days ago)
- Topics: csharp, netcore, netstandard, prng, random-number-generators, romu
- Language: C#
- Homepage: http://romu-random.org/
- Size: 32.2 KB
- Stars: 1
- Watchers: 3
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# RomuRandom
RomuRandom is a .NET implementation of the [Romu](http://romu-random.org/) family of
random number generators.[![Build Status](https://github.com/bgrainger/RomuRandom/workflows/Tests/badge.svg)](https://github.com/bgrainger/RomuRandom/actions)
[![NuGet](https://img.shields.io/nuget/vpre/RomuRandom)](https://www.nuget.org/packages/RomuRandom)## Usage
Use `RomuRandom` as a drop-in replacement for [`System.Random`](https://docs.microsoft.com/en-us/dotnet/api/system.random):
```csharp
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-199var 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](https://www.apache.org/licenses/LICENSE-2.0).