RandomNumberLink

From OpenCog
Jump to: navigation, search

The RandomNumberLink is a type of FunctionLink that, when executed, generates a uniformly distributed random number. For example, the following:

(cog-execute!
    (RandomNumber (Number 0) (Number 1)))

will return a random number between zero and one. Another example:

(cog-evaluate!
  (GreaterThan
     (Number "0.5")
     (RandomNumber (Number 0) (Number 1))))

will return true half the time, and false the other half.

See also