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

Add mt19937 random number generator to libcpp. #4746

Merged
merged 3 commits into from
Apr 20, 2022

Conversation

tillahoffmann
Copy link
Contributor

This PR adds the mt19937 random number generator to libcpp.

@scoder scoder added this to the 3.0 milestone Apr 18, 2022
@scoder
Copy link
Contributor

scoder commented Apr 18, 2022

Ah, yes, and then there's Py2, where PyLong objects end up with an L suffix. :-/
You can use print() for the values instead of returning them.

@da-woods
Copy link
Contributor

I believe it should be reproducible but it's probably worth confirming that works on Windows (on Appveyor) before merging.

@tillahoffmann
Copy link
Contributor Author

Ah, yes, and then there's Py2, where PyLong objects end up with an L suffix. :-/
You can use print() for the values instead of returning them.

What would be your thoughts on using ellipsis to get around the L python2 issue? For example,

>>> mt19937_discard(13)  # doctest: +ELLIPSIS
(1972458954..., 1972458954...)

It would get around some issues with printing because printing a tuple still uses repr on the elements. E.g. print((3L, 4L)) still prints (3L, 4L). Alternatively, we can print each value individually. Which option do you prefer?

@scoder
Copy link
Contributor

scoder commented Apr 19, 2022

What would be your thoughts on using ellipsis to get around the L python2 issue? For example,

>>> mt19937_discard(13)  # doctest: +ELLIPSIS
(1972458954..., 1972458954...)

Keep it safe and simple. Just use print(). (for each element)

@da-woods
Copy link
Contributor

I believe it should be reproducible but it's probably worth confirming that works on Windows (on Appveyor) before merging.

Looks like c++11 tests are currently skipped on Windows so for the moment it's probably not worth worrying about this.

@tillahoffmann
Copy link
Contributor Author

I've updated the tests with print calls. However, I've only tested it on python3 because I don't have python2 locally (it's a bit fiddly to install on Apple silicon using pyenv)

@scoder
Copy link
Contributor

scoder commented Apr 20, 2022

Thanks!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

3 participants