random-range

Synopsis

(random-range min max)

Parameters

  • min : the lower bound (including)
  • max : the upper bound (including)

Description

This procedure calls random() and delivers a random, unbiased integer within the specified range (including the boundaries). The min value must be arithmetically smaller than max.

Side Effects

Return Value

A random integer is returned.

Example

> (random-range 1 6)
1
> (random-range 1 6)
2
> (random-range -2 -1)
-2
> (random-range -2 -1)
-1
>