Initial data commit
This commit is contained in:
parent
72d218235f
commit
f23f22d71c
199087 changed files with 3378941 additions and 0 deletions
|
|
@ -0,0 +1,21 @@
|
|||
import java.util.Random;
|
||||
public class SevenSidedDice
|
||||
{
|
||||
private static final Random rnd = new Random();
|
||||
public static void main(String[] args)
|
||||
{
|
||||
SevenSidedDice now=new SevenSidedDice();
|
||||
System.out.println("Random number from 1 to 7: "+now.seven());
|
||||
}
|
||||
int seven()
|
||||
{
|
||||
int v=21;
|
||||
while(v>20)
|
||||
v=five()+five()*5-6;
|
||||
return 1+v%7;
|
||||
}
|
||||
int five()
|
||||
{
|
||||
return 1+rnd.nextInt(5);
|
||||
}
|
||||
}
|
||||
Loading…
Add table
Add a link
Reference in a new issue