Re: Positive random number



Spoon said:

pete wrote:

The return value of rand isn't guaranteed to be positive.

What does "positive" mean?

Greater than zero.

Is x positive if and only if x > 0?

Yes.

Does that mean that 0 is neither positive nor negative?

Yes.

For the record, the rand function computes a sequence of
pseudo-random integers in the range 0 to RAND_MAX.

Yes.

--
Richard Heathfield <http://www.cpax.org.uk>
Email: -http://www. +rjh@
Google users: <http://www.cpax.org.uk/prg/writings/googly.php>
"Usenet is a strange place" - dmr 29 July 1999
.



Relevant Pages

  • Re: next term
    ... Richard Heathfield ... Google users: ... me@here> cat mapping.dot | dot -Tpng -o mapping.png ...
    (rec.puzzles)
  • Re: Searching in a random list
    ... them at the outset. ... Richard Heathfield ... Google users: ...
    (comp.programming)
  • Re: Whats the position of pointers
    ... will pop into your head, ... Richard Heathfield ... Google users: ...
    (comp.lang.c)
  • Re: new random numbers function
    ... So as long as you don't mind getting a two or a three 90% of the ... Richard Heathfield ... Google users: ...
    (rec.puzzles)
  • Re: An age-old riddle
    ... inscription into its right proportions. ... Richard Heathfield ... Google users: ...
    (rec.puzzles)