I don't know how to name a title for my question. Here is the problem:
//Setup all the stats.
var randomStat = Math.floor(Math.random() * ((monster.level + 5) - monster.level + 1) + monster.level);
var multiplier = randomStat * itemQuality.qualityMultiplier;
//Assign the Stats.
var strength = Math.floor(multiplier * itemSubType.strengthMultiplier / 2); //divide each stat by 2 for better balance
var endurance = Math.floor(multiplier * itemSubType.enduranceMultiplier / 2);
var agility = Math.floor(multiplier * itemSubType.agilityMultiplier / 2);
var dexterity = Math.floor(multiplier * itemSubType.dexterityMultiplier / 2);
var wisdom = Math.floor(multiplier * itemSubType.wisdomMultiplier / 2);
var intelligence = Math.floor(multiplier * itemSubType.intelligenceMultiplier / 2);
var luck = Math.floor(multiplier * itemSubType.luckMultiplier / 2);
What it does, is create a randomStat variable and multiplier variable, then use them for each stat. My problem is that if each stat i.e. "strengthMultiplier" is the same as "enduranceMultiplier" which is the case sometimes, then stats will be exactly the same, because randomStat and multiplier is called just once and is used for every stat.
I am trying to create a loop for it, to call it 7 times, and each time its called use it for a single stat, up to 7 stats total. I could of course create 2 new variables for each stat (total 14) but I hope there is better way to do that, using loops. I am using javascript, so any help is welcome with javascript only, not jquery or anything else. Thanks :)