The problem with the code is, when I try to generate a number, if the spin is equal 1 it generates values inside range (1,2,3) if if try to use the loop to sum random values inside the same range the random number gerated is always the same while in loop,
example, if I run the loop with:
spind3 = 4 the values go from 4, 8, 12
spind3 = 5 the values go from 5, 10, 15
That means the first time the RandomNumber generates a value inside loop, it never change until the loop completes.
if (toggled3.Checked)
{
if (spind3.Value != 1)
{
for (int i = 1; i <= spind3.Value; i++)
{
diceCalc[1] += RandomNumber(1, 4);
}
}
else
diceCalc[1] = RandomNumber(1, 4);
}
See Question&Answers more detail:
os 与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…