我是靠谱客的博主 忐忑果汁,这篇文章主要介绍Unity-随机数,现在分享给大家,希望可以做个参考。

输出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-随机数内容请搜索靠谱客的其他文章。

本图文内容来源于网友提供,作为学习参考使用,或来自网络收集整理,版权属于原作者所有。
点赞(134)

评论列表共有 0 条评论

立即
投稿
返回
顶部