Page 1 of 1

Error in rand

Posted: Mon Jul 10, 2006 5:41 am
by Fanda
Hello all!

It seems that there is a small error in 'rand':

Code: Select all

> (set 'N 10)
10
> (rand 3 N)
(2 0 1 1 0 2 2 2 2 0 2)
> (length (rand 3 N))
11
Length of the generated list should be 10 (= N). 'rand' keeps returning one more than is needed.

This way:

Code: Select all

> (rand 5 0)
(4)
Also:

Code: Select all

> (rand 5 -1)
never returns result (infinite loop).

- Fanda

PS: I am using newLISP v.8.9.0 on Win32 MinGW

Posted: Mon Jul 10, 2006 7:10 am
by Lutz
Thanks Fanda, this will work again in 8.9.1

Lutz