(not tested)
i=floor((1-epsilon(1.))*real(Nt,4)*tmp_ran) + 1
or
i=(Nt-1)*tmp_ran + 1
Tim Prince
----- Original Message -----
From: "Olivier Fliegans" <[log in to unmask]>
To: <[log in to unmask]>
Sent: Friday, August 04, 2000 4:04 AM
Subject: [LF] Problem with random numbers (LF95)
> Hi,
>
> I would like to generate some integer numbers between 1 and Nt.
> Usually I use the following piece of code
>
> call random_number(tmp_ran)
> i=floor(tmp_ran*real(Nt,4)) + 1
>
> Unfortunately, under the Lahey compiler (5.5-Linux) this gives me
> numbers between 1 and Nt+1, in other words tmp_ran can be equal to 1.
> (which AFAIK is not standard conforming).
>
> Any suggestion?
> Thanks in advance
> --
> Olivier FLIEGANS
> HMI, Bereich Theoretische Physik E-mail: [log in to unmask]
> Glienicker Str. 100 Tel: (49) 30 8062 3193
> D-14109 BERLIN Fax: (49) 30 8062 2098
> GERMANY
> ----------------------------------------------------------
> To unsubscribe, send to <[log in to unmask]> the following
> as the first and only line of the message body:
> unsubscribe fortran
> ----------------------------------------------------------
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
|