how can I generate random number between specific numbers?

It only generates random numbers between 0 and 10 , how could I generate a number for example between these (1,5,8,9,12)?

Add those numbers to an array and select an index at random

var myCodes = new Int[5];

myCodes[0] = 1;
myCodes[1] = 5;
myCodes[2] = 8;
myCodes[3] = 9;
myCodes[4] = 12;

var index = Random.Range(0, myCodes.Length);

var myRandomNumber = myCodes[index];

You can store the numbers you want to choose in an array, then select a random element of that array.

int[] integers = new int[] {1, 5, 8, 9, 12 }

int randValue = Random.Range(0, integers.Length);
int value = integers[randValue];

Hope that helps!

You could put them in an array: int[] numbers=new int[]{1,5,8,9,12};

Then grab a random element: Debug.Log(numbers[UnityEngine.Random.Range(0, numbers.length-1)]);

If you have a specific set of possible numbers in mind, you first have to put them in a collection and pick randomly from there.

int[] numbersToChooseFrom = new int[] {3, 6, 9};
int index = Random.Range(0, numbersToChooseFrom.Length);
int yourNumber = numbersToChooseFrom[index]