Skip to content
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

[Feature request] Allow to use a faster PRNG #6

Open
mratsim opened this issue May 4, 2018 · 4 comments
Open

[Feature request] Allow to use a faster PRNG #6

mratsim opened this issue May 4, 2018 · 4 comments

Comments

@mratsim
Copy link

mratsim commented May 4, 2018

Currently Quicktest uses nim-random/Random which uses the cryptographic data from /dev/urandom.

This doesn't scale, especially on servers in controlled environment (Travis, Appveyor) with no inputs/processes that serve as source of randomness.

The /dev/urandom quickly gets starved and Quicktest stalls.

I tried running millions of tests overnight, but I couldn't complete the first one: or-ing 2 arrays - https://github.com/status-im/nim-stint/blob/master/tests/property_based_uint256.nim#L26

The fastest PRNG in Nim currently is from stdlib random which also exhibits nice randomness property is xoroshiro128+. Benchmarks: http://xoshiro.di.unimi.it/

In nim-random it's probably the XorShift128+

@data-man
Copy link

data-man commented May 4, 2018

I prefer PCG.

@zah
Copy link

zah commented May 4, 2018

We'll be posting a bounty on fixing this issue, together with few additional requirements. The details are in the linked issue above.

@alehander42 would be the best person to claim the bounty as the author of the library. To do this, please submit a simple pull request in our repo, bumpting the quicktest version number when the fixes are available.

@alehander92
Copy link
Owner

alehander92 commented May 4, 2018

thank you, I'll continue the discussion in linked

@mratsim I'll add support for a private generator, just a note, I think urandom should never block: it might produce very unrandom results with low entropy, but it still should always return valid results at least on Linux: I can easily run a million tests in 10 seconds.

@mratsim
Copy link
Author

mratsim commented May 5, 2018

Edited my first post, "the fastest prng in Nim is stdlib random".

I'll check what was taking time then, it's strange.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

4 participants