Your problem is, the maximum number of random is exclusive.So in this loop:
for (i = 0; i <= 97; i++)
You are iterating over until the Sac[97]
, but you never assign a value to Sac[97]
because you never return 97
from your function.r.Next(0, 97);
will return 96
max.So your while loop never ends after all of your items become equal to #
. You need to change r.Next(0, 97);
to r.Next(0, 98);
or i <= 97;
to i < 97;