I write a function to generate a random long value between Long.MIN_VALUE and Long.MAX_VALUE, but it always return Long.MIN_VALUE, why ?
public static long randomLong() {
return (long) (Math.random()*(Long.MAX_VALUE-Long.MIN_VALUE)+Long.MIN_VALUE);
}
Thank you for helping me
Aucun commentaire:
Enregistrer un commentaire