Hello everyone out there I need some help again. CEHJ created this code for me from this question:

https://www.experts-exchange.com/Programming/Programming_Languages/Java/Q_20933110.html

How could this code be changed to start off with smaller numbers then when the numbers are increased larger numbers can be introduced as well? Can comments be added as well please?

import java.awt.*;

import java.awt.event.*;

import java.awt.image.*;

import java.util.*;

import java.lang.*;

public class TestIt {

public static void main(String[] args) {

printRows();

}

// paste the other cod in here

static void printRows() {

final int INDEX_LIMIT = 8;

final int BATCH_LENGTH_LIMIT = 8;

final int BATCH_SIZE = 4;

final int NUM_BATCH_GROUPS = 4;

int batchLength = 4;

// Disallow duplicates by using a Set

Set numbers = new HashSet();

for (int batchGroup = 0; batchGroup < NUM_BATCH_GROUPS; batchGroup++) {

// Add numbers if more needed

while (numbers.size() < batchLength && batchLength < BATCH_LENGTH_LIMIT) {

numbers.add(new Integer((int)(Math.random() * INDEX_LIMIT) + 1));

}

for (int batchSize = 0; batchSize < BATCH_SIZE; batchSize++) {

java.util.List list = new ArrayList(numbers);

// Shuffle and print

Collections.shuffle(list);

System.out.println(list);

}

batchLength++;

System.out.println();

}

}

}

https://www.experts-exchange.com/Programming/Programming_Languages/Java/Q_20933110.html

How could this code be changed to start off with smaller numbers then when the numbers are increased larger numbers can be introduced as well? Can comments be added as well please?

import java.awt.*;

import java.awt.event.*;

import java.awt.image.*;

import java.util.*;

import java.lang.*;

public class TestIt {

public static void main(String[] args) {

printRows();

}

// paste the other cod in here

static void printRows() {

final int INDEX_LIMIT = 8;

final int BATCH_LENGTH_LIMIT = 8;

final int BATCH_SIZE = 4;

final int NUM_BATCH_GROUPS = 4;

int batchLength = 4;

// Disallow duplicates by using a Set

Set numbers = new HashSet();

for (int batchGroup = 0; batchGroup < NUM_BATCH_GROUPS; batchGroup++) {

// Add numbers if more needed

while (numbers.size() < batchLength && batchLength < BATCH_LENGTH_LIMIT) {

numbers.add(new Integer((int)(Math.random(

}

for (int batchSize = 0; batchSize < BATCH_SIZE; batchSize++) {

java.util.List list = new ArrayList(numbers);

// Shuffle and print

Collections.shuffle(list);

System.out.println(list);

}

batchLength++;

System.out.println();

}

}

}

replace the following code:

static void printRows() {

final int INDEX_LIMIT = 8;

final int BATCH_LENGTH_LIMIT = 8;

final int BATCH_SIZE = 4;

final int NUM_BATCH_GROUPS = 4;

int batchLength = 4;

by:

static void printRows(int INDEX_LIMIT,int BATCH_LENGTH_LIMIT,int BATCH_SIZE,int NUM_BATCH_GROUPS,batchLeng

{

{

static void printRows() {

final int INDEX_LIMIT = 8;

final int BATCH_LENGTH_LIMIT = 8;

final int BATCH_SIZE = 4;

final int NUM_BATCH_GROUPS = 4;

int batchLength = 4;

// Disallow duplicates by using a Set

Set numbers = new HashSet();

for (int batchGroup = 0; batchGroup < NUM_BATCH_GROUPS; batchGroup++) {

// Add numbers if more needed

for (int batchSize = 0; batchSize < BATCH_SIZE; batchSize++) {

numbers.add(new Integer(batchSize + 1));

java.util.List list = new ArrayList(numbers);

// Shuffle and print

Collections.shuffle(list);

System.out.println(list);

}

batchLength++;

System.out.println();

}

}

import java.util.*;

public class TestIt {

public static void main(String[] args) {

printRows();

}

static void printRows() {

final int INDEX_LIMIT = 8;

final int BATCH_LENGTH_LIMIT = 8;

final int BATCH_SIZE = 4;

final int NUM_BATCH_GROUPS = 4;

int batchLength = 4;

// Disallow duplicates by using a Set

Set numbers = new HashSet();

for (int batchGroup = 0; batchGroup < NUM_BATCH_GROUPS; batchGroup++) {

// Add numbers if more needed

for (int batchSize = 0; batchSize < BATCH_SIZE; batchSize++) {

numbers.add(new Integer(batchSize + 1));

java.util.List list = new ArrayList(numbers);

// Shuffle and print

Collections.shuffle(list);

System.out.println(list);

}

batchLength++;

System.out.println();

}

}

}

>>// Add numbers if more needed

should be changed to

// Add numbers up to the batch size

to avoid confusion

What would be easier is if you specified exactly what you want

1. How many sets of numbers should there be? We define set here as [x, y, z] etc.

2. How many numbers in each set?

3. Do you want the sets grouped, i.e.

[x, y]

[y, x]

[x, y, z]

[z, y, x]

[x, y, z, a]

[a, y, z, x]

4. Is that pattern good for you (swapping outer numbers)?

etc

Just go into that a bit more would you? Do we take it that the numbers are the numbers of particular exercises and you want to create a random order for the purposes of varying the rountines?

1 2 3

1 3 2

2 1 3

2 3 1

3 1 2

3 2 1

1 2 3 4

1 2 4 3

1 3 2 4

1 3 4 2

1 4 2 3

1 4 3 2

2 1 3 4

2 1 4 3

2 3 1 4

2 3 4 1

2 4 1 3

2 4 3 1

3 1 2 4

3 1 4 2

3 2 1 4

3 2 4 1

3 4 1 2

3 4 2 1

4 1 2 3

4 1 3 2

4 2 1 3

4 2 3 1

4 3 1 2

4 3 2 1

Well there's not a single repeating pattern in the list i just posted of course ...

Please provide your email to receive a sample view!

*This site is protected by reCAPTCHA and the Google Privacy Policy and Terms of Service apply.