random.seed(): What does it do?

I am a bit confused on what random.seed() does in Python. For example, why does the below trials do what they do (consistently)? >>> import random >>> random.seed(9001) >>> random.randint(1, 10) 1 >>> random.randint(1, 10) 3 >>> random.randint(1, 10) 6 >>> random.randint(1, 10) 6 >>> random.randint(1, 10) 7 I couldn’t find good documentation on this. … Read more

Is java.util.Random really that random? How can I generate 52! (factorial) possible sequences?

I’ve been using Random (java.util.Random) to shuffle a deck of 52 cards. There are 52! (8.0658175e+67) possibilities. Yet, I’ve found out that the seed for java.util.Random is a long, which is much smaller at 2^64 (1.8446744e+19). From here, I’m suspicious whether java.util.Random is really that random; is it actually capable of generating all 52! possibilities? … Read more

Seeding the random number generator in Javascript

Is it possible to seed the random number generator (Math.random) in JavaScript? 16 s 16 No, it is not possible to seed Math.random(). I’ve implemented a number of good, short and fast Pseudorandom number generator (PRNG) functions in plain JavaScript. All of them can be seeded and provide high quality numbers. First of all, take … Read more