Returns a random number between 0.0 [inclusive] and 1.0 [inclusive] (Read Only).
Both 0.0 and 1.0 may be returned by this property. This behaviour is different to that of many other random number generators which return a value less than but never exactly equal to 1.0.
using UnityEngine;
public class Example : MonoBehaviour { void Start() { Color randomColor = RandomColor(); }
// Generate a random color value. Color RandomColor() { // A different random value is used for each color component (if // the same is used for R, G and B, a shade of grey is produced). return new Color(Random.value, Random.value, Random.value); } }
Did you find this page useful? Please give it a rating: