axiom-developer
[Top][All Lists]

## [Axiom-developer] [#227 'random()\$Integer' is a strange function]

 From: wyscc Subject: [Axiom-developer] [#227 'random()\$Integer' is a strange function] Date: Mon, 14 Nov 2005 04:01:08 -0600

```Changes http://wiki.axiom-developer.org/227RandomIntegerIsAStrangeFunction/diff
--
Are you serious?  random() is a categorical specification and it is not
possible to be more specific without knowing the domain. It is certainly useful
in creating derived random functions that are more meaningful such as random(n)
or random(m,n). It does not mean that n is limited to 2^26. A grep for
random()\$INT shows uses in other domains (such as Float, Fraction Integer).
There are many algorithms (like factoring integers) that use monte carlo
methods.

Of course, one only implements pseudo-random numbers and not truely random
numbers on computers (excluding quantum computers). But that is generally
understood. Once restricted to a finite integer interval, uniform distribution
makes sense even if it may only be programmed approximately.

It should be the responsibility of each domain to be specific on what random()
exactly does and the algorithm used, but not at the category level. So for
random()\$INT, yes, the documentation should say the random number lies between
1 and 2^26. But that is not crucial since developers know that, and for users,
there is random(n)\$INT for any n (also implemented in Lisp), which one should