Bad comment for unity's function "int" Random.Range.

In untiy:
//
// Summary:
// Returns a random float number between and min [inclusive] and max [inclusive]
// (Read Only).
public static int Range(int min, int max);

in documents:

Returns a random float number between and min [inclusive] and max [inclusive] (Read Only).

The true one is the document’s version, I’v checked.

There are two different versions of this function.

The version which accepts float values is inclusive for both parameters.

The version which accepts int values is exclusive on its max value (which maxes it convenient for referencing a random index of an array).

eg:

myArray[Random.Range(0,myArray.Length)]

I’m talking only on the int version ( look at the code example i’v posted ).

I still can’t work out where you’re seeing the bad version. You seem to be saying the docs are right, but there is some example code somewhere that is wrong? Where is it? Let me know and I’ll fix it! :slight_smile:

You can see the mistake when opening visual studio/mono developer and right click on the Random.Range function and pick “Go To Definition”.
There you will see the functions with their comments.

Oooh I see, looks like that’s actually coming from the Unity sourcecode itself! I’ll see what I can do.

Which version of Unity are you seeing this in? I just had a look in 5.3 and I’m seeing a different (correct) version, and I also notice that the commands marked ‘obsolete’ in mine aren’t marked like that in yours, so perhaps you’re looking at an older version of unity?

Here’s what mine looks like:

Sorry for the thread necro, but I’m also seeing this in 5.3.4f1.