반응형
- 코드 작성
using UnityEngine;
using System.Collections.Generic;
public class RandomNumberGenerator : MonoBehaviour
{
private List<int> exclusionList = new List<int>() { 2, 3, 5, 6 }; //제외할 값
private int GenerateRandomNumber(int min, int max)
{
int randomValue = Random.Range(min, max);
while (exclusionList.Contains(randomValue))
{
randomValue = Random.Range(min, max);
}
return randomValue;
}
}
반응형