diff --git a/character.c b/character.c index a49b080..9c95e8a 100644 --- a/character.c +++ b/character.c @@ -21,8 +21,9 @@ int hp; int dieroll(int num,int sides){ int total = 0; - for(num;num>0;num--){ + while (num > 0) { total = total + arc4random_uniform(sides)+1; + num--; } return total; } @@ -60,10 +61,9 @@ void classProfs(unsigned long* classprofs, int count, int num){ classprofs[i]=local; } //Grab the first N elements, based on the class's value, but first, if we have more profs than available profs, get some random ones - if(num > count){ - for(count;num > count;count--){ - addProf(1lu << arc4random_uniform(18)); - } + while (num > count){ + addProf(1lu << arc4random_uniform(18)); + count--; } for(int i=0;i<=num;i++){ addProf(classprofs[num]);