axiom-developer
[Top][All Lists]

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

 From: kratt6 Subject: [Axiom-developer] [#227 'random()\$Integer' is a strange function] Date: Tue, 15 Nov 2005 02:39:06 -0600

```Changes http://wiki.axiom-developer.org/227RandomIntegerIsAStrangeFunction/diff
--
I disagree:

- 'random()' has meaning only if I specify a distribution. If no distribution
is
specified, usually the uniform distribution is taken. There is no uniform
distribution
on the integers, nor on the reals.
By the way: random without an argument is not a lisp function!

- I am not proposing to remove 'random()' for finite sets. If it is known how
to select
an element from a certain finite set - for example the set of partitions of
\$k\$ - then
it should be implemented. In fact: it is.
By the way: I don't see how knowing the size of a set helps with creating a
random
element. I believe one needs some way of enumerating the elements?
Furthermore, I think that lines like 'random()\\$Z rem 11' are a bad idea,
since the
resulting distribution will be nearly uniform, but not quite... Do you know
why such
code was written?

- I did not say that it is impossible to create a random element of the
integers
according to some distribution. Only: it cannot be the uniform
distribution...
To generate random Integers according to a specific distribution we have
'RIDIST'.

Apart from the usage in 'D01AGNT' - where 'random()\\$Integer' is used to
generate a seed, did you find any other places where 'random()\\$Integer' is
used?

Finally: Which CAS defines a function random for floats? I checked Mathematica
and MuPAD, the both define functions that return a (uniformly distributed)
float between zero and one. This is reasonable, since most (all?) other
distributions can be generated from that one.

Martin
--