I have a program used to resolve tied die rolls using a RNG that is recursive and could potentially cause the variables in question to exceed the maximum allowance for a normal integer variable.
Will this cause an error? Will it cause my program to crash?
Here is the code:
//This is the method in question. Everytime it is invoked it multiplies the previous //result of each roll by 100 and adds the result of a 20 sided die using an RNG
public void reRoll(){
for(int i = 0; i < playerlist.size(); i++){
playerlist.get(i).initroll = (playerlist.get(i).initroll*100) + Dice.d20();
}
}
//This is the recursive call to that method. If it receives too many ties, such as when it //is used several million times, it will cause the integer value to expand past its initial //boundaries, potentially causing an error
public void resolveTies(){
while(checkTies() == true){
reset();
reRoll();
compareGroup();
}
}
Keep in mind this code isn't fully tested yet, and this is my first time trying to talk shop with an outsider, (self taught) so I hope what I'm saying makes sense.