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

Implement mt_srand_array #2089

Closed
wants to merge 1 commit into from

Conversation

6 participants
@Metabolix
Copy link
Contributor

Metabolix commented Aug 19, 2016

This PR proposes a new function mt_srand_array, as requested in bug 32145. This function will seed the MT19937 PRNG with more than 32 bits, which some people think necessary for statistic calculations. The implementation is compatible with the one provided by the MT authors in their example code.

@tom--

This comment has been minimized.

Copy link

tom-- commented Aug 19, 2016

Cool!

Can you add a tests with negative integers in the seed array as well as positive? It doesn't need to be a long seed array since it's just a portability test.

@Metabolix Metabolix force-pushed the Metabolix:mt_srand_array-pr branch from 55b3f2f to 6ddf754 Aug 20, 2016

@Metabolix

This comment has been minimized.

Copy link
Contributor Author

Metabolix commented Aug 20, 2016

Modified patch to include negative seed tests.

Implement mt_srand_array
The new function mt_srand_array is used to seed the MT19937 PRNG
with more than 32 bits. The function takes an array of integers
and seeds the PRNG. The seeding procedure is compatible with
init_by_array() in mt19937ar.c by MT19937 authors.
If an input value cannot be converted to 32-bit integers,
a warning will be generated and the PRNG will not be seeded.

@Metabolix Metabolix force-pushed the Metabolix:mt_srand_array-pr branch from 6ddf754 to ca9f010 Aug 20, 2016

@Metabolix

This comment has been minimized.

Copy link
Contributor Author

Metabolix commented Aug 20, 2016

... and now also fixed that portability. ;)

@cmb69

This comment has been minimized.

Copy link
Contributor

cmb69 commented Sep 7, 2016

Thanks for the PR!

Supporting "init_by_array()" should be done, IMO, but have you considered to pass the array to mt_srand()?

@krakjoe

This comment has been minimized.

Copy link
Member

krakjoe commented Jan 3, 2017

@Metabolix can we know the status of this PR please ?

@spinitron

This comment has been minimized.

Copy link

spinitron commented Jan 3, 2017

Fwiw, I recall the corresponding internals discussion was drawn to a close here.

@krakjoe

This comment has been minimized.

Copy link
Member

krakjoe commented Jan 3, 2017

Ok then, since the author seems to agree with the consensus on internals, that this is not the best solution, I'm closing this PR.

Please take this action as encouragement to pursue the solution agreed upon on internals.

@krakjoe krakjoe closed this Jan 3, 2017

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.