Porl123 Posted September 1, 2008 Share Posted September 1, 2008 I've tried making a random decimal number with $rand = rand(0.1,0.5); but it just returns the 0. Is there something I'm missing or is it a different function I need? Much thanks in advance Quote Link to comment https://forums.phpfreaks.com/topic/122156-random-decimal-numbers/ Share on other sites More sharing options...
Porl123 Posted September 1, 2008 Author Share Posted September 1, 2008 Nobody have any ideas? Quote Link to comment https://forums.phpfreaks.com/topic/122156-random-decimal-numbers/#findComment-630666 Share on other sites More sharing options...
AndyB Posted September 1, 2008 Share Posted September 1, 2008 http://ca.php.net/manual/en/function.rand.php - and the first line is ... rand — Generate a random integer For your example, try $rand = 0.1*rand(1,5) instead Quote Link to comment https://forums.phpfreaks.com/topic/122156-random-decimal-numbers/#findComment-630669 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.