RNG and Reproducibility
- Computers are deterministic: we build them so they do what we tell them to do
- That means they don't generate truly random numbers by themselves
- Instead, they take a seed (generated from entropy like mouse movements or exact time), and generate pseudorandom values from it
- Example using a simple algorithm, here our seed is 3141 and we're generating random values from 0 to 99
- When applying any algorithm that uses randomness (like many approximate statistical tests), setting a seed ensures you get the same values every time
set.seed(3141)
would do this
People reading your code are not likely to trust you if it looks like you cherry-picked a seed! Prefer set.seed(12345)
to set.seed(429)
. A good random number generator (RNG) will give good results regardless of your input seed.
RNG and Reproducibility
- Computers are deterministic: we build them so they do what we tell them to do
- That means they don't generate truly random numbers by themselves
- Instead, they take a seed (generated from entropy like mouse movements or exact time), and generate pseudorandom values from it
- Example using a simple algorithm, here our seed is 3141 and we're generating random values from 0 to 99
- When applying any algorithm that uses randomness (like many approximate statistical tests), setting a seed ensures you get the same values every time
set.seed(3141)
would do this
People reading your code are not likely to trust you if it looks like you cherry-picked a seed! Prefer set.seed(12345)
to set.seed(429)
. A good random number generator (RNG) will give good results regardless of your input seed.