Zoe Phoenix wrote:
> If I wanted a program to return a random percentage of a number, like,
> 3% to 5% of 237, how would I do this?  I know rand(101) would return a
> random number between 0 and 100, but I'm not sure how to have a random
> percentage of a number returned. Help, please?

rand(num*(max - min + 1)/100) + num*min/100

example

rand(237*(5 - 3 + 1)/100) + 237*3/100

Regards,
Park Heesob
-- 
Posted via http://www.ruby-forum.com/.