Blade Maker Posted October 27, 2010 Posted October 27, 2010 The random function is there anyway to make it do a percentage? Quote
Djkanna Posted October 27, 2010 Posted October 27, 2010 Like? $rand = rand(10,30); $num = ($numAgain/100)*$rand; Quote
Blade Maker Posted October 27, 2010 Author Posted October 27, 2010 Not quite. Its kinda like rand(3%,12%) I know that code is wrong but its just a sketch of what I want. Quote
a_bertrand Posted October 27, 2010 Posted October 27, 2010 A percent is just a number over 100, so if you want a number between 0 and 100% => $r=rand(0,100); Then when you want to get that out of another number=> $val=$mynumber*$r/100; or $r=rand(0,100)/100.0; $val=$mynumber*$r; Quote
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.