msu-sparta / OpenRAND

Reproducible random number generation for parallel computations
https://msu-sparta.github.io/OpenRAND/
MIT License
26 stars 2 forks source link

Add efficient range function for integral types #20

Closed Shihab-Shahriar closed 9 months ago

Shihab-Shahriar commented 9 months ago

Code mostly taken from here, credits to Lemire.

For range N and floating point types, we use the basic rand() * N formula in the uniform method.

For integral type, uniform by default uses biased version. Users can use non-biased verison by directly invoking range.