question about random select
Posted
by davit-datuashvili
on Stack Overflow
See other posts from Stack Overflow
or by davit-datuashvili
Published on 2010-06-03T07:26:40Z
Indexed on
2010/06/03
12:34 UTC
Read the original article
Hit count: 137
algorithm
here is code print number in decreasing order
import java.util.*;
public class select {
public static void Select(int m,int n){
Random r=new Random();
if (m>0)
if (r.nextInt(0x3fff8001) % n <m ){
System.out.println(n-1);
Select(m-1,n-1);
}
else{
Select(m,n-1);
}
}
public static void main(String[]args){
int m=35;
int n=200;
Select(m,n);
}
}
and question is how to changes code such that print number in increasing order? please help
© Stack Overflow or respective owner