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
srand not implemented, fails silently #639
Comments
Considering it'd require a PRNG implementation anyway to allow for Dealing with the performance tradeoff, there could exist a Edit: Here's a Javascript port of the same Mersenne Twister implementation MRI is based on, mt19937ar: https://gist.github.com/banksean/300494 |
@mieko I was just gonna post the link to that Gist too, because I hadn't seen your edit yet ;-) |
Ah, cool to know they're compatible, @wmnnd. Here's a sketch of Random, if anyone wants to play with it. It has not been tested or even ran (I don't have the connectivity to get a full Opal stack set up this weekend). Otherwise I'll get back to it later. |
I'm interested in implementing this. |
I did use mieko's code in my implementation |
to be clear, I used this js in my implementation: https://gist.github.com/banksean/300494 |
Fixed in #1540 |
Random::srand seems to be not implemented, instead it fails silently.
I find this problematic because it creates inconsistent results with other Ruby implementations. I have tried this code sample in both MRI and JRuby and received the same results.
On a side note, the methods of Random can only be accessed as Object::method in Opal and not as Random::method.
P.S.:
I know that JavaScript's own pseudorandom number generator doesn't support seeding. Would there be any other way to fix this?
The text was updated successfully, but these errors were encountered: