FAQ Database Discussion Community
java,ios,swift,compatibility,prng
Here's my delimna: I am writing an application that needs to exactly reproduce the PRNG output from a game that was written in Java that uses the Java random() with a given seed to create all it's initial game 'world' data. The problem I am facing is that Java's random()...
c++,c++11,prng
In the code given below, I would like to implement a flag (or something equally simple) that has the same effect as commenting out the local setting and using the global setting some times (yielding two different numbers in this example), and using the local setting at other times (yielding...
maple,prng,lcg
i was "finding Pi" with Monte Carlo Method, but the answer was incorrect. The oryginal code was: RandomTools[MersenneTwister]: with(Statistics): tries := 10000: s := 0; for i to tries do if GenerateFloat()^2+GenerateFloat()^2 < 1 then s := s+1 end if; end do: evalf(4*s/tries) It gives answer aroud 2.8-2.85 when I...
c,prng,shift-register
I am trying to understand how change the galois LFSR code to be able to specify the output bit number as a parameter for the function mentioned below. I mean I need to return not the last bit of LFSR as output bit, but any bit of the LFSR (...
c++,c++11,random,distribution,prng
On Stackoverflow there are many questions about generating uniformly distributed integers from a-priory unknown ranges. E.g. C++11 Generating random numbers from frequently changing range Vary range of uniform_int_distribution The typical solution is something like: inline std::mt19937 &engine() { thread_local std::mt19937 eng; return eng; } int get_int_from_range(int from, int to) {...
c++,c,performance,prng
I've been playing around with Xorshift* random number generators, and I came across this exploration of their properties. Quoting from that site (emphasis mine): How can a xorshift64* generator be slower than a xorshift1024* generator? Dependencies. The three xor/shifts of a xorshift64* generator must be executed sequentially, as each one...
netlogo,prng
Since I am not well-versed in mathematics, I am struggling with the implementation of a random number generator in NetLogo which follows roughly a pareto distribution. This is the follow-up question of this one here, where I would like to substitue the random-float with something like "random-pareto" in order to...