how to make a progressive/dynamic integer

i want to make a random int in between 0 and the array length and the level number so the more higher the level the more harder the enemy is in the array or the more higher the array count is but when it reaches the max in the array length i want it to stop which i could do with

if(currentprogressionint <= enemy.length){
//stop
}else{
//progression mark
}

Good day.

You need to use this tools:

  1. Random.Range (To random select a number from a minimum to a maximum)
  2. Array.Lenght (Determinate the number of elements in an array)
  3. Mathf.Max (Determinate the higher number inside an array)

Using this 3 tools you should be able to determinate what you need.

If helped, accept the answer :D

You could use Random.Range but you make the minimum value depending on the level.
for example:

int levelNumber = ...
int enemyDiffculty = Random.Range(levelNumber, difficultyMax);

The levelNumber should not exceed the difficultyMax of course, and difficulty max can be your Array.Length value

Please update the question with more information. It is still not clear what is it exactly that you would like to achieve.

If you want to generate monsters at most the current level difficulty, then the following code will work:

enemyIndex = Random.Range(0, Mathf.Min(currentProgressionInt + 1, enemy.Length)); // +1 needed to include currentProgressionInt as possible value