Canadiengland Posted March 18, 2007 Share Posted March 18, 2007 how would i make it so that this script recognizes that the random numbers are with 2 decimal places, and make it so it doesnt just round them up? $randomattack=rand(.95,1.05); $randomdefence=rand(.95,1.05); Link to comment https://forums.phpfreaks.com/topic/43222-random-with-decimals/ Share on other sites More sharing options...
AndyB Posted March 18, 2007 Share Posted March 18, 2007 from the manual: rand — Generate a random integer So you'll need $var = rand(95,105) / 100; Link to comment https://forums.phpfreaks.com/topic/43222-random-with-decimals/#findComment-209845 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.