Search
 
SCRIPT & CODE EXAMPLE
 
CODE EXAMPLE FOR CSHARP

system.random reuses numbers

//Function to get a random number 
private static readonly Random random = new Random(); 
private static readonly object syncLock = new object(); 
public static int RandomNumber(int min, int max)
{
    lock(syncLock) { // synchronize
        return random.Next(min, max);
    }
}
Source by stackoverflow.com #
 
PREVIOUS NEXT
Tagged: #reuses #numbers
ADD COMMENT
Topic
Name
1+6 =