samedi 1 avril 2017

Setting enum value to random in java

import java.util.*;
public enum Skills {
Random r= new Random();

//trying to use nextInt method in some case 
SKILLS(r.nextInt(125)+25),
VEHICLE(r.nextInt(125)+25),
ACCURACY(),WEAPONS(23),REFLEX(),
STRATEGY(),CHARISMA(),
HACKING(r.nextInt(125)+25),
SPEED(r.nextInt(125)+25),
STEALTH(r.nextInt(125)+25);
//end of skills 

private int value;
private Skills(int value){
    this.value=value;
}
public int getValue() {
    return value;
}
}

I can't set the values of my enum to random. Later I will give these skills to characters in my game. I cant use the nextInt method either. Why is that ? How to solve the problem and use this enum properly?




Aucun commentaire:

Enregistrer un commentaire