输出0,1的随机数
//Unity-随机数
using System.Collections;
using System.Collections.Generic;
using UnityEngine;
public class Demo : MonoBehaviour
{
// Start is called before the first frame update
void Start()
{
//Random.Range是unity提供的API
//取前不取后,这里的范围是0和1,不会有2
int randomNum = Random.Range(0, 2);
print(randomNum);
}
}
最后
以上就是忐忑果汁最近收集整理的关于Unity-随机数的全部内容,更多相关Unity-随机数内容请搜索靠谱客的其他文章。
本图文内容来源于网友提供,作为学习参考使用,或来自网络收集整理,版权属于原作者所有。
发表评论 取消回复