Monkuar Posted May 28, 2013 Share Posted May 28, 2013 (edited) 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 Edited May 28, 2013 by Monkuar Quote 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...
Solution Barand Posted May 28, 2013 Solution 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'])); Quote 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
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.