Search:

Type: Posts; User: Baldyr

Search: Search took 0.15 seconds.

  1. Re: how to ensure that my method wont return the same random number twice in a row

    I'm throwing my two pence in. Would this work?

    int previousRand = 0;
    int newRand = 0;
    Random rand = new Random();

    int getAnotherRand(int range){
    if(range == 0) {
    return 0;
    }
  2. Re: how to ensure that my method wont return the same random number twice in a row

    This was my initial idea, also, but it fails because the returned value might now be out of range. A fix would only get messy, because there could be a very narrow range and whatnot.
Results 1 to 2 of 3