Blade Maker Posted October 27, 2010 Share Posted October 27, 2010 The random function is there anyway to make it do a percentage? Quote Link to comment Share on other sites More sharing options...
Djkanna Posted October 27, 2010 Share Posted October 27, 2010 Like? $rand = rand(10,30); $num = ($numAgain/100)*$rand; Quote Link to comment Share on other sites More sharing options...
Blade Maker Posted October 27, 2010 Author Share 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 Link to comment Share on other sites More sharing options...
a_bertrand Posted October 27, 2010 Share 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 Link to comment Share on other sites More sharing options...
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.