ostafen / smart

String Matching Algorithms Research Tool
https://smart-tool.github.io/smart/
GNU General Public License v3.0
4 stars 2 forks source link

Is rand() portable accross O/S and versions? #77

Open nishihatapalmer opened 1 year ago

nishihatapalmer commented 1 year ago

We rely on being able to repeat tests and benchmarks by setting a random seed. Is the rand() C function guaranteed to produce the same results on all platforms and versions?

We should consider adding simple PRNG to smart to ensure fully deterministic sequences.

nishihatapalmer commented 1 year ago

If we wanted to use a built-in PRNG, then the XOSHIRO** generator looks robust, simple and widely used in other platforms, e.g. in .NET.

https://en.wikipedia.org/wiki/Xorshift

It would ensure that all tests and benchmarks were repeatable no matter what the O/S or c library we linked against.