Randomize GUI Position

is it possible to use a random.range inside a gui?
for exemple:

GUI.Label(Rect(Screen.width/2+80, Sceen.height/2 (Random.Range(-125,80)) , 100,100, “”);

hope someone can help, thanks.

The OnGUI is updated every frame, so this will be very “jumpy”… You probably want to use Lerp to smooth it out…

You are missing a * for multiply for it to work. Also, Rect has 4 parameters:

GUI.Label(Rect(Screen.width/2+80, Screen.height/2 * Random.Range(-125,80),100,100) , "jumpy");

No trouble - you can use any Random or Mathf function as argument. Random.Range comes in two flavors: if you pass integer arguments (like in your example), it returns an integer >= min and < max, thus in your example the range is actually -125 to 79. If you pass float arguments (-125.0 to 80.0, for instance), a float >= -125 and <= 80.