int MathRand( | ) |
Example:
MathSrand(TimeLocal());
// Displays 10 numbers.
for(int i=0;i<10;i++ )
Print("random value ", MathRand());
sergeev >>:
Функция возвращает псевдослучайное целое число в дипазоне от 0 до 32767. Перед первым вызовом функции необходимо использовать функцию MathSrand, чтобы перевести генератор псевдослучайных чисел в начальное состояние.
int MathRand( | ) |
Пример:
I know that!
I'm asking about the range (0.1).
I'm sorry, if you're looking for a range.
MathSrand(TimeLocal()); // Отображает 10 чисел. for(int i=0; i<10; i++ ) Print("произвольная величина ", MathRand()/32768);
something like this.
MathSrand(TimeLocal()); ............... ............... ............... //---------------------------Непрерывный Генератор СЧ--------------------- double CRG(double min,double max) { return(min+((max-min)*MathRand()/32767.0));} //=======================================================================
where:
min - range start
max - end of range.
In your case it will be:
void Start() { MathSrand(TimeLocal()); ............... ............... ............... double p=CRG(0.0,1.0); } //---------------------------Непрерывный Генератор СЧ--------------------- double CRG(double min,double max) { return(min+((max-min)*MathRand()/32767.0));} //=======================================================================
if so,
double ran= MathRand()/32768.;then between n/32768. and n+1/32768. at n e Z & n e [0.32767] is empty. This is not good.
gumgum писал(а) >>
if so,
then between n/32768. and n+1/32768. with n e Z & n e [0.32767] is empty. This is not good.Do you know, dear fellow, that there is an infinite number of real numbers between any real numbers, however close to each other?
And do you know that the interval (0,1) is equivalent to an infinite line in power?
If no - think about it.
If yes - formulate your question correctly.
At the same time try to say at what density (pieces per unit length) do you want to have a MF generation ?
Or maybe you want your GSF to generate all numbers a segment of (0,1) ?
You are missing trading opportunities:
- Free trading apps
- Over 8,000 signals for copying
- Economic news for exploring financial markets
Registration
Log in
You agree to website policy and terms of use
If you do not have an account, please register
Generation of uniformly distributed random numbers (0,1) by MQL tools without external *.dll?