Search:

Type: Posts; User: Cornix

Search: Search took 0.11 seconds.

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

    Here is some pseudo code for my solution from post #2:

    1) generate random number i
    2) check against previous random number
    3) if equal, go to 1)
    4) save i as "new" previous number
    5) return i
  2. Re: how to ensure that my method wont return the same random number twice in a row

    The simple way would be to remember what value you returned the last time.
    When your method is called again and the random value you got is the same as last time you simply produce another random...
Results 1 to 2 of 2