stats
stats copied to clipboard
Add a global stats::random_engine_t.
This commit enables setting an explicit random number seed globally. This is useful when using the vectorized wrappers which do not otherwise support setting a seed. This commit is tested only with Blaze.
There are many possible ways add support for seeding the vector wrappers, and this pattern seemed the simplest to me. It is not the first pattern attempted. I do not really expect you to merge this as is, but maybe just think about and describe the correct, idiomatic way to possibly support this feature. I don't mind actually doing the work on it, if you give me the guidance of how you want it done. It would also be better if all the distributions were ported to the favored pattern; this commit only experimented with rnorm
and rinvwish
.
It is also not clear to me yet how to best fix this for thread safety. Maybe it is sensible to change static rand_engine_t
to thread_local rand_engine_t
, but this would require users to understand those semantics.
vectorized wrappers which do not otherwise support setting a seed
Fixed in version 3.3.0.