954,523 Members — Technology Publication meets Social Media
Username:
Password:
Lost login information?
Have something to say? Contribute New Article Reply to this Article

Randoming these set of arrays without repetition

Hi guy how do I randomize these numbers inside this arrays?

private double amounts[] = { 0, 0.01, 1000000, 25, 250000, 75, 50, 1000,
			200, 100, 400000, 750, 5000, 750000, 500, 100000, 300, 75000, 800,
			20, 300000, 10, 50, 750, 25, 5, 1 };


I want to randomize them without reptition so that I could insert them into this line of code so that each briefcase will hold a different value.

public void casesSetup() {	
		for (int i = 0; i < briefcase.length; i++) {

			if (i == 0) {

			} else {
				briefcase[i] = new Briefcase();
				double value = amounts[i];
				briefcase[i].setAmount(value);
				briefcase[i].setFace(i);
			}
		}
	}


Thanks in advance :D

chiiqui
Junior Poster
107 posts since Sep 2011
Reputation Points: 10
Solved Threads: 3
 

This is a duplicate of the OP's post http://www.daniweb.com/software-development/java/threads/381276 where it has already been answered.

JamesCherrill
Posting Genius
Moderator
6,371 posts since Apr 2008
Reputation Points: 2,130
Solved Threads: 1,073
 

This article has been dead for over three months

Post: Markdown Syntax: Formatting Help
You
View similar articles that have also been tagged: