Print

Print


At 19:22 04-06-02 +0800, Liu H Q wrote:


>In c/c++, there is a integer rand generator, rand().
>This kind of generator can generate integer among the range defined.
>for example, if i wnat to get randomic integer from 0 to 5, just write
>rand()%(5+1)




>For F99/F77, how can I then?
>I am anxious to know who can I get the random integer from 0 to 1.

Try the following:

  call random_number(R)

  I_rand = nint(R)

! Or more general  J_rand = Low + int(R*(High-Low+1))

>Sincerely,
>Liu H Q.
>

Best regards,

\---

Jan van Oosterwijk
Netherlands
mailto:[log in to unmask]
http://huizen.dto.tudelft.nl/vanOosterwijk/