double randomnumber1 = MathRand()/32600.;
OMG it works. Why is that little dot not in the literature?
I just managed to get it to work myself by doing:
Double randomnumber1 = (MathRand()+0.000000000)/32600;
Cheers
OMG it works. Why is that little dot not in the literature?
I just managed to get it to work myself by doing:
Double randomnumber1 = (MathRand()+0.000000000)/32600;
Cheers
It is in the literature, just a little hidden away: https://docs.mql4.com/basis/types/casting
Forum on trading, automated trading systems and testing trading strategies
Before operations (except for the assignment ones) are performed, the data are converted into the maximum priority type. Before assignment operations are performed, the data are cast into the target type.
Examples:
int i=1/2; // no types casting, the result is 0 |
Your code was like the example highlighted in yellow.
Alain's was like the example highlighted in green.
- docs.mql4.com
- Free trading apps
- Over 8,000 signals for copying
- Economic news for exploring financial markets
You agree to website policy and terms of use
I have a variable...
Double randomnumber1 = MathRand()/32600;
But randomnumber1 keeps coming back as 0.0 even though MathRand is choosing random numbers between 0 and 32600!! I just want a decimal number between 0 and 1. JEEEEESUS.
I've spent so long on trying to get this one line to work. How is it done?