Posted March 24, 201312 yr Hey, i have to generate a random value between 0 and 2 for a switch, I've done it like this at the moment: Random rand = new Random(); switch(rand.nextInt(3)) { case 0: case 1: case 2: } it should work (as far as i know) but its not ^^ It's always taking the last, the 2 Never 0 or 1 I'd like 2 know why someone knows why? Cheers, -East http://eastcrips.square7.ch/.0909DSsigMD/MF_Sig.png[/img] http://eastcrips.square7.ch/SigShop/MF-IC!6.php[/img]
March 24, 201312 yr Author oh, ty! i used to script samp servers (GTA SA multiplayer, maybe u've heard of it), i didnt nead a break each time, just case 2: was enough tought its like this in java too http://eastcrips.square7.ch/.0909DSsigMD/MF_Sig.png[/img] http://eastcrips.square7.ch/SigShop/MF-IC!6.php[/img]
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.