This is the code:
public void testPopulate (int num)
{
ArrayList<String> great = new ArrayList<String>();
for (int i = 0; i < num; i++)
{
Random gen = new Random();
int b = 0;
b = gen.nextInt(100) + 1;
great.add("Account: " + (BASE_ACC_NUM + i));
great.add("Balance: " + b);
System.out.println(great);
}
} // testPopulate
This is the solution:
[Account: 10000, Balance: 6]
[Account: 10000, Balance: 6, Account: 10001, Balance: 83]
[Account: 10000, Balance: 6, Account: 10001, Balance: 83, Account: 10002, Balance: 31]
[Account: 10000, Balance: 6, Account: 10001, Balance: 83, Account: 10002, Balance: 31, Account: 10003, Balance: 74]
[Account: 10000, Balance: 6, Account: 10001, Balance: 83, Account: 10002, Balance: 31, Account: 10003, Balance: 74, Account: 10004, Balance: 72]
[Account: 10000, Balance: 6, Account: 10001, Balance: 83, Account: 10002, Balance: 31, Account: 10003, Balance: 74, Account: 10004, Balance: 72, Account: 10005, Balance: 18]
[Account: 10000, Balance: 6, Account: 10001, Balance: 83, Account: 10002, Balance: 31, Account: 10003, Balance: 74, Account: 10004, Balance: 72, Account: 10005, Balance: 18, Account: 10006, Balance: 39]
[Account: 10000, Balance: 6, Account: 10001, Balance: 83, Account: 10002, Balance: 31, Account: 10003, Balance: 74, Account: 10004, Balance: 72, Account: 10005, Balance: 18, Account: 10006, Balance: 39, Account: 10007, Balance: 4]
[Account: 10000, Balance: 6, Account: 10001, Balance: 83, Account: 10002, Balance: 31, Account: 10003, Balance: 74, Account: 10004, Balance: 72, Account: 10005, Balance: 18, Account: 10006, Balance: 39, Account: 10007, Balance: 4, Account: 10008, Balance: 18]
[Account: 10000, Balance: 6, Account: 10001, Balance: 83, Account: 10002, Balance: 31, Account: 10003, Balance: 74, Account: 10004, Balance: 72, Account: 10005, Balance: 18, Account: 10006, Balance: 39, Account: 10007, Balance: 4, Account: 10008, Balance: 18, Account: 10009, Balance: 31]
Acc# Name Balance
[Account: 10000, Balance: 100]
[Account: 10000, Balance: 100, Account: 10001, Balance: 27]
[Account: 10000, Balance: 100, Account: 10001, Balance: 27, Account: 10002, Balance: 4]
[Account: 10000, Balance: 100, Account: 10001, Balance: 27, Account: 10002, Balance: 4, Account: 10003, Balance: 37]
[Account: 10000, Balance: 100, Account: 10001, Balance: 27, Account: 10002, Balance: 4, Account: 10003, Balance: 37, Account: 10004, Balance: 73]
Acc# Name Balance
How does that work? I have it doing what I want it to do which is, generate an account number which is incremented and then create a random balance. However, I don't need all of those darn repeats.