How can I get a progressive sequence without repetition?

My teacher told me to make a Matrix Menu, where I can choose options like fill randomly or row with highest sum…

I want to make the "FilllRandomly" option have more options, I made it use only even numbers, only odd numbers, or just random.

I tried to make an option to fill it in a progressive or descending way, like 1, 3,11, 27,56,82,87 (I must insert a minimum and maximum value).

I always end up with like 5 numbers before I reach the maximum limit say

22, 26,87,91,100,100,100,100,100,100

27,78,98,100,100,100,100,100,100,100

Is there a way to make it always different? like:

1,23,25,29,72,74,78,82,87,89,99,100?

I tried this:

 case 3: last = low; int z; high -= a.GetLength(0) * a.GetLength(1); for (i = 0; i < a.GetLength(0); i++) { for (j = 0; j < a.GetLength(1); j++) { z = (i * j) + j + 1; a[i, j] = r.Next(last, high + z); last = a[i, j]; } } break; 

by CSHelpPlox via /r/csharp

Leave a Reply