hi there,
i want to randomly pick an element from an array, so i used the following code.
Random rndCell = new Random((int)DateTime.Now.Ticks);
while (true)
{
rndCell.Next(aCells.Length);
int rndIndex = Convert.ToInt32(rndCell.ToString());
if (aCells[rndIndex] != null)
{
aCells[rndIndex] = SOMETHING;
// DO SOMETHING ELSE WITH rndIndex...
break;
}
}
it raises an error while trying to convert the random number to integer. does anyone knows how to do it?
best regards,
Sean