输出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);
}
}