stats icon indicating copy to clipboard operation
stats copied to clipboard

Add a global stats::random_engine_t.

Open 12AT7 opened this issue 3 years ago • 1 comments

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.

12AT7 avatar Sep 20 '21 00:09 12AT7

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.

12AT7 avatar Sep 20 '21 00:09 12AT7

vectorized wrappers which do not otherwise support setting a seed

Fixed in version 3.3.0.

kthohr avatar Aug 21 '22 21:08 kthohr