f95 - random numbers

Ludwig795

Junior Member
Sep 18, 2007
16
0
0

I have code in fortran, compiled by f95. Code use random numbers.

To have everytime different rundom numbers I use different seeds generated at start of program by

call itime(timeArray) ! Get the current time
i = rand ( timeArray(1)+timeArray(2)+timeArray(3) )

Check show that there is different numbers = if I see to first random numbers -like 10, 20 random numbers - they are diffrent.

But, I amk use bunch of random numbers and when I look at results of simulation, results are very simmilar, what can not be real. I am suspicious that random (peudorandom numbers) are repeating (or less probably this is because diferent programs are started in similar time) or there is another reason.

Can you help me/advise me something/give me any direction to go ?

Thank you.
 

Ludwig795

Junior Member
Sep 18, 2007
16
0
0
It can not be, it can not converge to in such way, moreover this is not convergence but similarity.

Similarity means that results are different with diffrent numbers of used random numbers, diffrent after diffrent statistic but similar starting with iffrent seeds.
 

Crusty

Lifer
Sep 30, 2001
12,684
2
81
I'm having a hard time understand what you are writing.

Can you clarify

Check show that there is different numbers = if I see to first random numbers -like 10, 20 random numbers - they are diffrent.

But, I amk use bunch of random numbers and when I look at results of simulation, results are very simmilar, what can not be real. I am suspicious that random (peudorandom numbers) are repeating (or less probably this is because diferent programs are started in similar time) or there is another reason.
 

Markbnj

Elite Member <br>Moderator Emeritus
Moderator
Sep 16, 2005
15,682
14
81
www.markbetz.net
Check show that there is different numbers = if I see to first random numbers -like 10, 20 random numbers - they are diffrent.

I don't think you can rely on a simple check for duplicates in order to know whether you are getting psuedorandom numbers or not. If you're concerned about the quality of the results, run the generator a million times and count the frequency for each value into buckets. Each number should have the same chance of appearing as any other number, therefore the counts should be roughly equal. You can plot the distribution and see how far off of flat it is.

Remember that random doesn't mean ordered sequences or duplicates can't appear in the results. If you select a 5 digit number randomly, then "11111," "12345," and "34256" all have an equal chance of occuring in the output.

On the other hand, if you consistently see apparently ordered sequences then I would be suspicious too. Try it for different seeds and see if the results are the same.