random no for floating no:
Guys plz help me out to calculate random floatin number for a specified range...!!
plz help me...!!
Ok.
Typically you do rand() and mod it by the number you want as the top.
e.g.
rand() % 100
is 0->99. To do that for a float, you'd wanna pick a higher value.
e.g. top value of 100.00f and lowest of 0.00f with 2DP accuracy.
Get a random integer, then divide by 100 to move the decimal place.
make sense?
Topic archived. No new replies allowed.