This site is a static rendering of the Trac instance that was used by R7RS-WG1 for its work on R7RS-small (PDF), which was ratified in 2013. For more information, see Home.
Source for wiki RandomnessArcfide version 1
= Simple Randomness =
== Abstract ==
The following proposal provides a simple, minimal interface to random number generation. It allows both controlled random seeding and also a single procedure that provides randomness. It is designed to be simple and fairly useful.
== Rationale ==
Randomness is a common feature to use in education and general programming. Therefore, it makes sense to have WG1 standardize randomness to some degree. The current proposals on the table are either too complex or do not provide the necessary features. Specifically, when teaching about randomness, it is important to be able to control the way that randomness falls out when grading assignments or testing them.
== Specification ==
Returns a random value in the range [0.0, ''real''). When given an exact integer, the values returned must be exact integers; otherwise it will return a real value.
A parameter like procedure that allows the seed to be set and accessed. The procedure may be passed a single non-negative exact integer to set a specific seed.
== Design Rationale ==
I do not see any reason to have two procedures for getting a random value. These can be combined into one without requiring much trouble. Additionally, this one procedure is more general than the two procedures suggested by RandomCowan. It is also more simple than SRFI-27. The possibility of returning a 0.0 value from `random` is intentional to make the procedure behave in a more consistent manner. This should not be a problem, as suggested by RandomCowan, with `log` if `(log 0.0)` is defined to return `-inf.0`.