Random.Range is not working

Hello,
I am trying to test out the functionality of random.range. When I enter this into C#, the is an error saying that Random does not contain a definition for range. Is there new syntax for random number generating?

float rand = Random.Range(0, 4);
        Debug.Log(rand);

Thanks

float rand = UnityEngine.Random.Range(0, 4);
Debug.Log(rand);
There are using System; somewhere in your code. System has another Random, that don’t have Range() method.

nid help to fix the Random.Range …the range is not working

For those of you trying to get better/more unique random int’s you can use this function and supply the last random number generated:

private int FindNextUniqueNum(int lastNum, int min, int max)
    {
        int tries = 0;
        int result = 0;
        System.Random rng = new System.Random();

        result = rng.Next(min, max+1);
        while (result == lastNum && result <= max)
        {
            tries++;
            result = rng.Next(min, max+1);
            if (result > max) result = max;
            if (tries > 50)
                return result;
        }

        if (result > max) result = max;
        return result;
    }