How to generate random between 0 and 1 in Netlogo with uniform distribution

41 Views Asked by At

I am trying to do some testing and stumble across the problem that (random 2 = 0) does always give me much more 0 than 1s, even though it is supposed to be uniform distribution. Any ideas?

1

There are 1 best solutions below

0
LeirsW On

I'm pretty sure that is just a perception bias. You can check it out using the following code (that you can just copy-paste in the command center). Using n-values I repeat random 2 100000 times , then I use filter to only take the 0's, and finally length to count how many 0's these are.

show length filter [i -> i = 0] (n-values 100000 [random 2])

Running it 5 times I got 50068, 50028, 50051, 49991, and 50085 which gives no indication at all for there to be more 0's than 1's