homer said:Dead lucky to have you as a customer every week, tucking into her apple dumplings
"Vinegar Tits" Vera is still there, as well - keep away from her frosted cupcakes, though. Not nice
Steven said:I could write a Java Class to generate two random lists each 40 long, one containing the number chosen by a TBer and one corresponding to the number of the horse.
Then just take top of each list and that is the pairing and so on down the list.
I would even publish the code so there is no cheating. ;-) :mrgreen:
/*
* Created on 08-Apr-2005
*
* TODO To change the template for this generated file go to
* Window - Preferences - Java - Code Style - Code Templates
*/
package test;
import java.util.*;
/**
* @author Steven
*
* TODO To change the template for this generated type comment go to
* Window - Preferences - Java - Code Style - Code Templates
*/
public class Draw {
private void generateLists(int horses, int persons) {
Random r = new Random((Calendar.getInstance()).getTimeInMillis());
Random r1 = new Random();
Stack horsesS = new Stack();
Stack personsS = new Stack();
Hashtable h = new Hashtable();
Hashtable p = new Hashtable();
int loopCounter = 0;
// assume horse <= persons
while (loopCounter < horses) {
boolean numberGenerated = false;
// first the horses list
while (!numberGenerated) {
int i = r.nextInt(horses + 1);
if (i != 0) {
String s = Integer.toString(i);
boolean b = h.containsKey(s);
if (b) {
numberGenerated = false;
} else {
horsesS.push(s);
h.put(s, new Integer(i));
numberGenerated = true;
loopCounter++;
}
} else {
numberGenerated = false;
}
}
numberGenerated = false;
// then the persons list
while (!numberGenerated) {
int i = r1.nextInt(persons + 1);
if (i != 0) {
String s = Integer.toString(i);
boolean b = p.containsKey(s);
if (b) {
numberGenerated = false;
} else {
personsS.push(s);
p.put(s, new Integer(i));
numberGenerated = true;
}
} else {
numberGenerated = false;
}
}
}
System.out.println("The List is as follows :\n");
while ( !horsesS.isEmpty()) {
System.out.println("Horse number :- " + " " + horsesS.pop() +
" Person number :- " + " " + personsS.pop() );
}
}
public static void main(String[] args) {
int horses = 0;
int persons = 0;
try {
horses = Integer.parseInt(args[0]);
persons = Integer.parseInt(args[1]);
} catch (Exception e) {
System.out.println("We have an invalid number");
}
Draw d = new Draw();
d.generateLists(horses, persons);
}
}
The List is as follows :
Horse number :- 4 Person number :- 2
Horse number :- 10 Person number :- 25
Horse number :- 5 Person number :- 33
Horse number :- 35 Person number :- 18
Horse number :- 27 Person number :- 24
Horse number :- 40 Person number :- 22
Horse number :- 26 Person number :- 37
Horse number :- 34 Person number :- 36
Horse number :- 16 Person number :- 20
Horse number :- 37 Person number :- 38
Horse number :- 30 Person number :- 13
Horse number :- 1 Person number :- 26
Horse number :- 25 Person number :- 16
Horse number :- 18 Person number :- 3
Horse number :- 22 Person number :- 4
Horse number :- 13 Person number :- 19
Horse number :- 20 Person number :- 15
Horse number :- 39 Person number :- 7
Horse number :- 12 Person number :- 14
Horse number :- 24 Person number :- 1
Horse number :- 33 Person number :- 8
Horse number :- 29 Person number :- 11
Horse number :- 19 Person number :- 9
Horse number :- 36 Person number :- 17
Horse number :- 23 Person number :- 10
Horse number :- 2 Person number :- 12
Horse number :- 9 Person number :- 39
Horse number :- 6 Person number :- 5
Horse number :- 8 Person number :- 21
Horse number :- 11 Person number :- 29
Horse number :- 31 Person number :- 6
Horse number :- 15 Person number :- 40
Horse number :- 21 Person number :- 32
Horse number :- 38 Person number :- 27
Horse number :- 7 Person number :- 31
Horse number :- 14 Person number :- 28
Horse number :- 32 Person number :- 30
Horse number :- 3 Person number :- 34
Horse number :- 17 Person number :- 35
Horse number :- 28 Person number :- 23
P | Pld | Pts | |
1 | Liverpool | 11 | 28 |
2 | Manchester C | 11 | 23 |
3 | Chelsea | 11 | 19 |
4 | Arsenal | 11 | 19 |
5 | Nottm F | 11 | 19 |
6 | Brighton | 11 | 19 |
7 | Fulham | 11 | 18 |
8 | Newcastle | 11 | 18 |
9 | Aston Villa | 11 | 18 |
10 | Tottenham | 11 | 16 |
11 | Brentford | 11 | 16 |
12 | Bournemouth | 11 | 15 |
13 | Manchester U | 11 | 15 |
14 | West Ham | 11 | 12 |
15 | Leicester | 11 | 10 |
16 | Everton | 11 | 10 |
17 | Ipswich | 11 | 8 |
18 | Palace | 11 | 7 |
19 | Wolves | 11 | 6 |
20 | Southampton | 11 | 4 |