unity create random number int code example
Example 1: unity random int
//If you use Int in the Random.Range() then it will
//return an Int
public int RanTimerHigh = 10;
public int RanTimerLow = 1;
void Start()
{
int RandomInt = Random.Range(RanTimerLow, RanTimerHigh);
}
Example 2: unity random seed
using UnityEngine;
using System.Collections;public class ExampleClass : MonoBehaviour {
private float[] noiseValues;
void Start() {
Random.seed = 42;
noiseValues = new float[10];
int i = 0;
while (i < noiseValues.Length) {
noiseValues[i] = Random.value;
print(noiseValues[i]);
i++;
}
}
}