Search
 
SCRIPT & CODE EXAMPLE
 
CODE EXAMPLE FOR CSHARP

random unity

// 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 #unity
ADD COMMENT
Topic
Name
4+7 =