> The document says:
>    random   : % -> %
>       ++ random(n) creates a random element from 0 to \spad{n-1}.
> That is good if n is positive.  What if n is negative?

When n is 0 or negative then segment 0..(n - 1) is empty, so
call is incorrect.

> (2) -> random(-5)
>    >> System error:
>    Argument is neither a positive integer nor a positive float: -5

And you get  error, as expected.

> Also this definition can't cover the case when n is 0.
> I suggest to change the documentation and implementation to
> return a random element from 0 to n.

Current definition means that for positive n you get exactly n
values, each with probablility 1/n.  Your proposed change would
break this nice relationship.  For people who can not read
between lines we could add phrase: 'Error if n <= 0.'.

                              Waldek Hebisch

You received this message because you are subscribed to the Google Groups 
"FriCAS - computer algebra system" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to fricas-devel+unsubscr...@googlegroups.com.
To post to this group, send email to fricas-devel@googlegroups.com.
Visit this group at https://groups.google.com/group/fricas-devel.
For more options, visit https://groups.google.com/d/optout.

Reply via email to