Implementation of java.lang.Random in PHP and C
Posted
by
justinhj
on Stack Overflow
See other posts from Stack Overflow
or by justinhj
Published on 2014-08-22T22:17:11Z
Indexed on
2014/08/22
22:20 UTC
Read the original article
Hit count: 197
I'm looking for a random number generator that I can run in PHP, C and Java that will always return the same sequence of numbers for a given seed.
Here's the Java implementation I would use: java.util.random source
Whilst this would be fairly straightforward to port to C and PHP, there is potentially a lot of work to get all the edge cases correct and handle differences in number representation. I'd be extremely happy to just copy and paste a fully tested version should it exist.
© Stack Overflow or respective owner