Im currently making a random generator that spawns powerups every now and then. The problem is I’m trying to make some items more rare as you progress up in level and some items less rare the higher you get.

Here is what I have tried. Firstly I just tried to make items a set percentage

```
private int getPowerup()
{
int range = Random.Range(1, 101);
float atomic = 95;
float hammer = 60;
if(range >= atomic) {
return 9;
}else if(range >= hammer) {
return 10;
}
//else Gun
return 11;
}
```

Then I tried

```
private int getPowerup()
{
percentage = currentLevel / maxLevel;
int range = Random.Range(1, 101);
float atomic = 95 * (1 - percentage);
float hammer = 60 * percentage;
if(range >= atomic) {
return 9;
}else if(range >= hammer) {
return 10;
}
//else Gun
return 11;
}
```

But this doesn’t seem to be exactly what I was after either. Would anyone have any recommendations as to what I should try?

Thanks in advance