Search
 
SCRIPT & CODE EXAMPLE
 
CODE EXAMPLE FOR CSHARP

unity3d random

// Returns a number between 1 and 9 (inclusive, exclusive)
int randomInt = Random.Range(1, 10);

// Returns a number between -10.0 and 10.0 (inclusive, inclusive)
float randomFloat = Random.Range(-10.0f, 10.0f)

//If min is greater than max, the numbers are automatically swapped
 
PREVIOUS NEXT
Tagged: #random
ADD COMMENT
Topic
Name
3+7 =