Howdy, I had a quick question that I hope someone could provide an answer to. I created this program to fill an array with integers. All it does is randomly generate (or psuedo randomly) a number and store it in the first box and then second... until I run out of boxes. Usually after running this once or twice I get ...

So, you need an array of random, but unique integers? One way you could do this is by making a loop for all the elements of the array, and in each iteration generate a random number, check if it is already in the array, and if it is not, then put it in the array and go to the next iteration; ...

I've drawn two trees in Java that stand next to each other that are the same color and height. But I'm trying to code three sets of trees with different widths and get those three sets of trees to generate randomly when I run the code. The way I've coded it makes each triangle change widths at random, but I want ...

I trying to make a list of 100 random numbers between 1 and 100 without any of them repeating. I built a boolean array and assigned the value true as each number was chosen inside a for-if loop. The problem is that sometimes it takes about 600-800 iterations. I was wondering if there was a better way to do this. Is ...

Hi all. I am going to do sudoku game for my term project. what i wanted to ask u guys is about random integer generate. My random class generates 1 to 9 numbers. For example i want not to generate 5 in that class. how can i do this operation? any ideas? thank u.

Hi guys, been looking online and can;t seem to find how to do what I want. I'm basically looking through methods but want to create a random number. I know how to limit its top end but not sure how to limit both: For example a random number between 14-40. Any help is appreciated!

killer8685 wrote: Sorry for not explaining the problem!I want t generate a 3 digits number with values from 000 to 999.i dont want to be generated numbers with less then 3 digits!Is it possible!!??? Well mathematically 0, 00 and 000 is the same number. So what you need to generate is a 3-digit representation of a number. For that you can ...

Would someone be able to help me with code to generate a random integer, but restrict it to say <5 or <20? Am i forced to use something like an "if (number<20){" condition? Or is thier a way to set the restriction at the same time as generating the integer. Thanks. Edited by: JohnnySoprano on Apr 24, 2008 2:55 PM

Just having a few problems and I was just wondering if I could seek some assistance on this matter. Basically I have a game of Four in a Row...when the mouseReleased method is initiated the CPU's oval is placed in any column between 0 and 7. The random number generated should be the column in which the oval is placed. So ...

Hi!!! I am making a game where i put a "circle" on a coordinate board. the board is size of 12 X 12, and i need to make sure that each circle(12 circles) lie on a distince space. So each circle has its coordinate (x1, y1), (x2, y2),... so on. How can i create a random integer for the coordinates to ...

why not just put the 50 words into a List and then choose a random number from 1-50 and grab that word? if you want to know which letters in a String match the inputed character dont over think it. just iterate over the String or use the indexOf() method. [read the doc.|http://java.sun.com/j2se/1.4.2/docs/api/java/lang/String.html]

actually i have read a paper "improving QoS in Computational Grids through Schedule-based Approach", and the author used a set of data said to be generated from negative exponential distribution. each set of data have different average inter arrival time. i am trying to generate 5 different data sets. each sets have 1500 jobs with arrival time for each jobs. each ...