• Advertisement

Archived

This topic is now archived and is closed to further replies.

Trying to get a Pseudo random floating point number

This topic is 5734 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

If you intended to correct an error in the post then please contact us.

Recommended Posts

Ive done a quick search on the MSDN libaries and havent come up with anything useful my first impression leads me to think... eg a random number between 0..1 with 2 units of precission.... you could randomly generate a value for 0..1000 then divide it by a 1000 ? would this work ? or is their any easier way ?

Share this post


Link to post
Share on other sites
Advertisement
between 0 and 1 with 2 digits after the decimal would be divide by 100, or mulitply by 0.01


float inline frand ()
{
return (std::rand () % 100)*.01;
}

Share this post


Link to post
Share on other sites

  • Advertisement