Welcome to collectivesolver - Programming & Software Q&A with code examples. A website with trusted programming answers. All programs are tested and work.

Contact: aviboots(AT)netvision.net.il

Buy a domain name - Register cheap domain names from $0.99 - Namecheap

Scalable Hosting That Grows With You

Secure & Reliable Web Hosting, Free Domain, Free SSL, 1-Click WordPress Install, Expert 24/7 Support

Semrush - keyword research tool

Boost your online presence with premium web hosting and servers

Disclosure: My content contains affiliate links.

39,895 questions

51,826 answers

573 users

How to generate 8 digits int random number in Java

1 Answer

0 votes
import java.util.concurrent.ThreadLocalRandom;

public class program {
    public static int random_min_max(int min, int max) {
        return ThreadLocalRandom.current().nextInt(min, max);
    }
    public static void main(String[] args) {
        for (int i = 0; i < 10; i++) {
            System.out.println(random_min_max(10000000, 100000000));
        }
    }
}
 
 
 
/*
              
run:
 
64273469
80430213
29840797
56125056
10737303
32845395
96096320
34515886
12098854
80694309
     
*/

 

 



answered May 14, 2024 by avibootz

Related questions

1 answer 132 views
1 answer 152 views
1 answer 148 views
1 answer 350 views
1 answer 86 views
1 answer 88 views
1 answer 89 views
...