Skip to content

Instantly share code, notes, and snippets.

@imam-san
Created April 15, 2016 14:01
Show Gist options
  • Save imam-san/557fb044dc0dddd03b44fab452c2969c to your computer and use it in GitHub Desktop.
Save imam-san/557fb044dc0dddd03b44fab452c2969c to your computer and use it in GitHub Desktop.
import java.util.*;
public class Main {
// 23,60,36
public static int getint()
{
Random randomGenerator = new Random();
int randomInt = randomGenerator.nextInt(10927937);
if (/*(randomInt%1==0) || (randomInt%4==0) ||*/ (randomInt%7==0) )
randomInt=1;
else if (/*(randomInt%3==0) || (randomInt%8==0) ||*/ (randomInt%3==0) )
randomInt=3;
else if ((randomInt%2==0) || (randomInt%5==0) || (randomInt%9==0) || (randomInt%8==0) )
randomInt=2;
// System.out.println("" + randomInt);
return randomInt;
}
public static void main(String[] args) {
int [][] myList = new int [7][17];// = {1, 2, 3, 3};
int max1=23,max2=60,max3=36;
// Print all the array elements
for (int i = 0; i <17; i++) {
for (int j=0;j<7 ;j++)
{
boolean setf= false;
int genint =0;
while(!setf)
{
genint= getint();
if (genint==1)
{
if (max1 >0)
setf= true;
if (setf)
max1--;
}
else if (genint==2)
{
if (max2 >0)
setf= true;
if (setf)
max2--;
}
else if (genint==3)
{
if (max3 >0)
setf= true;
if (setf)
max3--;
}
myList[j][i]=genint;
// System.out.println("max 1 "+ max1);
// System.out.println("max 2 "+ max2);
// System.out.println("max 3 "+ max3);
}
}
}
for (int i = 0; i <7; i++) {
for (int j=0;j<17 ;j++)
{
System.out.print(" "+ myList[i][j] + ",");
}
System.out.println("");
}
System.out.println(" FINISH ");
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment