0

What is the rondom class?

how can make ,what is the method and which method of rondom class is most applicatable??

14th Jun 2018, 12:30 AM
Rahman Rezaie 🇦🇫
Rahman Rezaie 🇦🇫 - avatar
4 ответов
+ 1
Well, mos languages have a Random element. In Java we have the class Random and some methods inside it. To get a random value/number we can just use one of these methods such as: ´´´ Random rndObj = new Random(); int randomNumber = rnd.nextInt(); ´´´ The random numbers are used to several approaches. For example, a simple use is get a random element from a array. Look: ´´´ Random rndObj = new Random(); String[] colors = {"red", "green", "blue"}; System.out.println(colors[rndObj.nextInt(colors.length)]); //this should print a random color name from the array. ´´´ There are others methods inside Random class, like nextBoolean, nextGaussian, and so on.
14th Jun 2018, 1:11 AM
Lucas Sousa
Lucas Sousa - avatar
0
Did you mean... "random"?
14th Jun 2018, 12:40 AM
Lucas Sousa
Lucas Sousa - avatar
0
yes😁😂😂😂
14th Jun 2018, 12:41 AM
Rahman Rezaie 🇦🇫
Rahman Rezaie 🇦🇫 - avatar
0
tanx
14th Jun 2018, 1:12 AM
Rahman Rezaie 🇦🇫
Rahman Rezaie 🇦🇫 - avatar