public static float value ;

Descripción

Returns a random float within [0.0..1.0] (range is inclusive) (Read Only).

Important: Both the lower and upper bounds are inclusive. Any given float value between 0.0 and 1.0, including both 0.0 and 1.0, will appear on average approximately once every ten million random samples.

See Random for more examples of how UnityEngine.Random may be different from other random number generators.

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); } }
Copyright © 2023 Unity Technologies
优美缔软件(上海)有限公司 版权所有
"Unity"、Unity 徽标及其他 Unity 商标是 Unity Technologies 或其附属机构在美国及其他地区的商标或注册商标。其他名称或品牌是其各自所有者的商标。
公安部备案号:
31010902002961