Hi,
I'm developing an application on my Mac in generic c++ as I will want to port to other platforms at a later stage.
I'm using the random number generator - rand() to return an integer. Normally, this should return a number between 1 and 32767. However, it frequently returns numbers way bigger that that.
In short, I'm trying to generate normally distributed random numbers between 0 and 1.
Can anyone see where I'm going wrong in my usage or understanding of rand()?
Thanks,
John.
I'm developing an application on my Mac in generic c++ as I will want to port to other platforms at a later stage.
I'm using the random number generator - rand() to return an integer. Normally, this should return a number between 1 and 32767. However, it frequently returns numbers way bigger that that.
In short, I'm trying to generate normally distributed random numbers between 0 and 1.
Can anyone see where I'm going wrong in my usage or understanding of rand()?
Thanks,
John.