Skip to main content

4.8) Working With Stochasticity


Netlogo provides a range of pseudo-random numbers generated by random number generator (as usual for computer programs).

You can use from a range of random distributions (e.g. uniform, normal, poisson, exponential, and gamma). A uniform distribution U(a,b) between a and b would take the form of:

random (b-a) + a

and normal distribution N with a certain mean and variance would be called like this:

random-normal mean std

We can use stochasticity as well to randomly select, for example patches:

ask patches with [random 1 < density]

or selecting randomly one agent from an agentset using the primitive “one-of”

ask one-of patches [ set pcolor green ]