Code:
- Import java. Io. ioexception;
- Import java. util .*;
- Public class doubleball {
- Private int N [] = new int [6];
- Private random r = new random ();
- Public int [] doublebal (){
- Int I = 0;
- While (I <n. Length ){
- N [I] = R. nextint (33) + 1;
- If (compared (n, I, n [I]) {
- I ++;
- }
- }
- Return N;
- }
- Public Boolean compared (int n [], int index, int d ){
- Boolean flag = true;
- For (INT I = 0; I <index; I ++ ){
- If (N [I] = d ){
- Flag = false;
- }
- }
- Return flag;
- }
- Public void sortarray (int n []) {
- For (INT I = 0; I <n. length; I ++ ){
- Int temp;
- For (Int J = 0; j <n. length-i-1; j ++ ){
- If (N [J]> N [J + 1]) {
- Temp = N [J];
- N [J] = N [J + 1];
- N [J + 1] = temp;
- }
- }
- }
- }
- Public void printnums (int n ){
- For (int K = 0; k <n; k ++ ){
- Int [] n1 = doublebal ();
- Sortarray (N1 );
- System. Out. Print ("red ball :");
- For (INT I = 0; I <6; I ++ ){
- System. Out. Print ("/t" + add0 (N1 [I]);
- }
- System. Out. Print ("/T Blue ball:" + add0 (R. nextint (16) + 1) + "/N ");
- }
- }
- Public String add0 (int n ){
- String STR = "";
- If (n <10 ){
- STR = "0" + N;
- } Else {
- STR = N + "";
- }
- Return STR;
- }
- Public static void main (string ARGs []) {
- Doubleball DB = new doubleball ();
- DB. printnums (5 );
- }
- }
Run this program to generate a five-color two-color ball number. By modifying the parameters in db. printnums ();, you can control the number of bets generated. This code is for your reference only. If you use the resulting number as the bet code, the author shall not be liable for any consequences!