function
Library: Random number utilities (OMRANDOM)
Import : omrandom.xmd |
Returns: random numbers based on the exponential distribution |
define external integer function exponential average value integer lambda
Use random.exponential
to generate random numbers based on the exponential distribution. Over a large
number of trials, the average over all of the generated random numbers will tend towards the argument lambda.
This program generates 1000 random numbers with an exponential distribution and an average value of 20.
import "omrandom.xmd" prefixed by random. process repeat for integer i to 1000 output "d" % i || ": " || "d" % random.exponential average 20 || "%n" again