Monkuar Posted May 28, 2013 Share Posted May 28, 2013 topic title says it all: $rpgdata['max_dmg'] = 15; $rpgdata['min_dmg'] = 3; $maindamage = ($rpgdata['max_dmg'] / $rpgdata['min_dmg']); $maindamage will be output of 3. But this is not correct, a user having 3 to 15 min damage, needs to output atleast 10 damage per swing.... how to increase the value of 3 to atleast 7 or more as in this case? or wouldn't it be better to do something like? $maindamage = rand($rpgdata['min_dmg'], $rpgdata['max_dmg']); ? Not sure ty Link to comment https://forums.phpfreaks.com/topic/278471-need-to-get-the-above-average-value-not-the-divided-by-one/ Share on other sites More sharing options...
Barand Posted May 28, 2013 Share Posted May 28, 2013 If you want to constrain $maindamage to a minimum value of 10 $maindamage = max(10, ($rpgdata['max_dmg'] / $rpgdata['min_dmg'])); Link to comment https://forums.phpfreaks.com/topic/278471-need-to-get-the-above-average-value-not-the-divided-by-one/#findComment-1432728 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.