Download MetaTrader 5

Different random numbers at the same time

To add comments, please log in or register
DonFx
922
DonFx  

I want to get say 20 different random numbers "at the same time".

My problem - I think - is the seed (MathSrand(GetTickCount())). Even if I use some pause between the iterations, the result numbers are not so random as I wish.

If the desired range is between 0 - 1, then I got this sequence after 20 iterations using Sleep(500) between them: 11111100000000001111. My expectation would be eg.: 11010001011011010100.

So, is it possible to get a "good-looking" random number series without using a long pause between the iterations?

Thanks

whroeder1
16102
whroeder1  
You seed it once, only, at the start of the program.
DonFx
922
DonFx  
whroeder1:
You seed it once, only, at the start of the program.

Yes, I run MathSrand(..) within a function and called this function within the loop.

So, the elapsed interval counts.

Thank you WHR!

To add comments, please log in or register