Get the App
SLTechnology News&Howtos  ›  Internet Technology  › 

How to randomly generate 6-digit random number, 5-digit random number, 4-digit random number by java

Shulou Source: shulou.com Published: 2022-06-02 07:22:37 10月03日 Update

This article mainly explains "how java randomly generates 6-digit random number, 5-digit random number, 4-digit random number". The content of the explanation in the article is simple and clear, and it is easy to learn and understand. next, please follow Xiaobian's train of thought to study and learn "java how to randomly generate 6-digit random number, 5-digit random number, 4-digit random number".

/ / generate 6-digit random numbers (not 5 or 7 digits, only 6 digits): System.out.println ((int) ((Math.random () * 9 (1) * 100000)); / / similarly, generate 5-digit random numbers: System.out.println ((int) ((Math.random () * 9 (1)) * 10000)); / / similarly, generate 4 as random numbers: System.out.println (int) ((Math.random () * 9 (1)) * 1000)) Thank you for your reading, the above is the content of "how java randomly generates 6-digit random number, 5-digit random number, 4-digit random number". After the study of this article, I believe you have a deeper understanding of how java randomly generates 6-digit random number, 5-digit random number and 4-digit random number. Here is, the editor will push for you more related knowledge points of the article, welcome to follow!

Tags: Random numbers generation learning content only that is ideas situations articles more knowledge knowledge points articles follow questions practice push research verification Apple Docker Huawei Linux macOS MariaDB Microsoft MySQL NVidia OPPO Reno NVidia Linux vpn MariaDB Redmi