-
Notifications
You must be signed in to change notification settings - Fork 0
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
API design #1
Comments
Implement a Lehmer random number generator (see #6). |
Possible API: |
Other suggestion for API:
PS: With a generator the PRNG state cannot be inspected and that is annoying. |
|
Another idea for a purely functional API: const prng = xoroshiro128plus(options); // OR splitmix64()
const seed = [1, 2, 3, 4];
let state = getState(prng, seed);
let r = 0;
[state, r] = nextFloat(prng, state);
const buffer = new ArrayBuffer(100);
state = fill(prng, state, buffer);
const array = new Float32Array(1000);
state = fill(prng, state, array); |
It is not a good idea to have these generic methods for generating small random numbers. For instance, we should only use the most significant bit in |
Idea for a generator API:
|
Renamed `nextFloat` to `nextFloat64`. See #1.
Should at least implement a Mersenne Twister (see #5).
The text was updated successfully, but these errors were encountered: