Randomising in Certain Perameters

Discussion in 'Plugin Development' started by Harieo, Nov 21, 2015.

Thread Status:
Not open for further replies.
  1. Hello,

    I need to create a randomiser but I need to restrict it's output to either 0 or 1.
    It would also be nice to make it even, say 8 players, 4 with 0 and the next 4 with 1.

    Is this possible? And if so, how?

    Thanks,
    Harieo
     
  2. Offline

    PDKnight

    Hey,
    how do you want to join 0 with first 4 players and 1 with other 4 players?
    Anyway, to make a randomizer, make new Random() instance and get int from it :)

    PDKnight
     
  3. Yes but that int is unrestricted and if I get more than two different variables then my code is broken
     
  4. Offline

    Xerox262

    Random#nextInt(2); will give you a 0 or a 1 randomly.
    Video explaining randoms for you.
     
  5. Offline

    Mrs. bwfctower

    Zombie_Striker likes this.
Thread Status:
Not open for further replies.

Share This Page