Random range (556215)

Does anybody have an idea how I can get a random number, let’s say between 1 and a 100, but where higher numbers have a lower frequency of coming up?

You need to do maths
Use some equation to change a linear input 1->100 into a non-linear output 1->100
for example (x*0.1)^2
blue is the linear case, horizontal axis is input, vertical is output

In script would look like

int value = (int)( Mathf.Pow(Random.Range(0f, 100f) * 0.1f, 2f) );

Note: this is marginally simpler if you work in the 0 → 1 range

2 Likes

Thanks for the answer and the math lesson!