mardi 3 mars 2015

Get Random integer value C#

Why using the method RandomBool(), I always get 1? Please, help fix the second method.



static class Tools
{
public static int RandomNumber(int end)
{
var rand = new Random(DateTime.Now.Millisecond);
return rand.Next(0, end);
}

public static bool RandomBool()
{
if(RandomNumber(1) == 0)
return true;
else
return false;
}
}




Aucun commentaire:

Enregistrer un commentaire