|
forums.silverfrost.com Welcome to the Silverfrost forums
|
View previous topic :: View next topic |
Author |
Message |
Anonymous Guest
|
Posted: Fri Dec 17, 2004 10:11 am Post subject: Random function |
|
|
Hello,
Could anybody show me an example of the use of the random function and the modification of the seed at each call of the subroutine (random_seed for example). I can't manage to have random values when I start my program.
Thank you for your answer
TL |
|
Back to top |
|
|
Anonymous Guest
|
Posted: Sat Dec 18, 2004 8:44 am Post subject: Random function |
|
|
I think you should be able to generate a non repeatable sequence of pseudo-random numbers by calling to set the seed. Perhaps something like this:
[pre]INTEGER :: Seed
REAL :: X
CALL SYSTEM_CLOCK(COUNT = Seed)
CALL RANDOM_SEED(PUT = Seed)
CALL RANDOM_NUMBER(HARVEST = X)
WRITE (UNIT=*,FMT="(A,I10)") "Seed = ", Seed
WRITE (UNIT=*,FMT="(A,F12.10)") "X = ", X[/pre]
I hope this helps.
- Miguel. |
|
Back to top |
|
|
|
|
You cannot post new topics in this forum You cannot reply to topics in this forum You cannot edit your posts in this forum You cannot delete your posts in this forum You cannot vote in polls in this forum
|
Powered by phpBB © 2001, 2005 phpBB Group
|