Sets the seed for the random number generator.
private var noiseValues: float[];function Start () {
// If you comment out the following line, the sequence of random
// values will be different each time you run. However, the sequence
// will always be the same for any particular seed value.
Random.seed = 42;
noiseValues = new float[10];
for (var i = 0; i < noiseValues.Length; i++) {
noiseValues[i] = Random.value;
print(noiseValues[i]);
}
}
using UnityEngine; using System.Collections; public class Example : 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++; } } }
import UnityEngine import System.Collections public class Example(MonoBehaviour): private noiseValues as (float) def Start() as void: Random.seed = 42 noiseValues = array[of float](10) i as int = 0 while i < noiseValues.Length: noiseValues[i] = Random.value print(noiseValues[i]) i++