English Deutsch Français Italiano Español Português 繁體中文 Bahasa Indonesia Tiếng Việt ภาษาไทย
All categories

hi everyone her I have a problem for you and actully my problem and I wanna share it with everyone here oky

The problem haw to generate a list of integers from x to y e.g. 1-100 and it is generated in an increasing order e.g. 1,6,23,25,29,34,........ 98 and actually this is the real problem
the needed number of integers is 20

The Q is how to do that by coding and is there a method in java that handel this issu ?
================
oky have a look what i done so far
java code:
mport java.util.*;


public class mainclass{
public static void main(String [] args ){
Random rand = new Random();
int x =1;
int curr =0;
for(int t =0;t<10;t++){



while(x100){
x = rand.nextInt() % 100;

}
curr =x ;
System.out.println(x) ;

}



}}

any idea :)

2006-10-15 18:25:20 · 2 answers · asked by max hit 1 in Computers & Internet Programming & Design

they must be generated in order without sorting them at the end

2006-10-15 19:35:57 · update #1

2 answers

I don't really know how to help you then, sorry. It seems like it would almost be impossible to get 20 integers in a row, because at some point you are bound to get a high number and limit your possible future numbers significantly.

what you are doing looks good, but i do have one code suggestion. When you are getting your rand int, you could call nextInt(101). See api link below for why its 101.

I don't know if this is acceptable, but you could limit the range for each number. For instance, the first has to be from 1 - 5, the second from 6 - 10, and so on.

2006-10-15 18:43:20 · answer #1 · answered by Brady 3 · 0 0

Your physique could be balanced and comfortable whilst shooting the basketball. listed under are some regulations to solid stability. First, your feet could be approximately shoulder width aside with the intention to grant you a solid base. Secondly, your solid foot (the foot on the comparable element of your physique as your shooting hand) could be a pair of a million/2 step earlier than the different. ultimately, your head could be wide-unfold. this might shop you balanced for the duration of the shot and permit you to shoot devoid of having to make adjustments. all truthfully everyone seems to be inbuilt a various way, so if any of those are slightly off, yet you're nevertheless comfortable - that's what's important.

2016-12-26 20:19:53 · answer #2 · answered by ? 3 · 0 0

fedest.com, questions and answers