unity random number between code example

Example 1: unity random number

Random.Range(-10.0f, 10.0f);

Example 2: 10 random numbers unity

void Start(){   //having an int Array of 10 members   int [] numbers = new int[10];   //using a string variable to keep record of the used numbers   string usedNumbers ="-";   //cycle to get 10 random numbers   for (int i = 0 ; i<10; i++)   {      //get a random number between 0 - 120, 0 and 120 included on the random numbers      int randomNumber = Random.Range(0,121);      //Checking if the random number you get is unique, if you already have it in the string means that this random number is repeated, the "-X-" is to make the difference between the numbers, like -1- from -11-, if you dont have the "-X-" the 1 is in 21 and would be a "repeated" number      while(usedNumbers.Contains("-"+randomNumber.ToString()+"-"))      {         //if a number is repeated, then get a new random number         randomNumber = Random.Range(0,121);      }      usedNumbers+= randomNumber.ToString()+"-";      numbers[i] = randomNumber;   }}