Why does the fRand float variable receive integer result in this example? Random produces a correct number, then it is divided by 100 and for some reason decimal part is cut off. What is the logic behind this?
Random randValue = new Random();
float fRand;
fRand = randValue.Next(1, 1000) / 100;
label1.Text = fRand.ToString("F");
Aucun commentaire:
Enregistrer un commentaire