Random.value 随机值

static var value : float

Description描述

Returns a random number between 0.0 [inclusive] and 1.0 [inclusive] (Read Only).

返回一个随机数,在0.0(包括)~1.0(包括)之间。(只读)

Both 0.0 and 1.0 may be returned by this function.

这个函数可以返回0.0和1.0的数。

using UnityEngine;
using System.Collections;

public class example : MonoBehaviour {
	public void Awake() {
		print(Random.value);
	}
}
// Prints something between 0 and 1
//打印值在0~1之间

print(Random.value);
Page last updated: 2011-1-19