![subject](/tpl/images/cats/informatica.png)
Computers and Technology, 10.06.2021 21:40 arcanos616p53hw1
In this exercise, we are going to create a static class Randomizer that will allow users to get random integer values from the method nextInt() and nextInt(int min, int max).
Remember that we can get random integers using the formula int randInteger = (int)(Math. random() * (range + 1) + startingNum).
nextInt() should return a random value from 1 - 10, and nextInt(int min, int max) should return a random value from min to max. For instance, if min is 3 and max is 12, then the range of numbers should be from 3 - 12, including 3 and 12.
This is what I have so far:
public class RandomizerTester
{
public static void main(String[] args)
{
System. out. println("Results of Randomizer. nextInt()");
for(int i = 0; i < 10; i++)
{
System. out. println(Randomizer. nextInt());
}
//Initialize min and max for Randomizer. nextInt(min, max)
int min = 5;
int max = 10;
System. out. println("\nResults of Randomizer. nextInt(5,10)");
for(int i = 0; i < 10; i++)
{
System. out. println(Randomizer. nextInt(min ,max));
}
}
}
public class Randomizer
{
private static int range;
private static int startingNum;
private static int nextInt;
private static int max;
private static int min;
public static int nextInt()
{
//Implement this method to return a random number from 1-10
//Randomizer randInteger = new Randomizer();
int randInteger = (int)(Math. random() * (11) + startingNum);
return Randomizer. nextInt;
}
public static int nextInt(int min ,int max)
{
//Implement this method to return a random integer between min and max
int randInteger = (int)(Math. random() * (max - min + 1) + min);
return Randomizer. nextInt(min, max);
}
}
![ansver](/tpl/images/cats/User.png)
Answers: 1
![](/tpl/images/ask_question.png)
![](/tpl/images/ask_question_mob.png)
Another question on Computers and Technology
![question](/tpl/images/cats/informatica.png)
Computers and Technology, 22.06.2019 15:30
Which of the following examples has four beats in each measure?
Answers: 2
![question](/tpl/images/cats/informatica.png)
Computers and Technology, 23.06.2019 15:00
What is the total resistance in a circuit that contains three 60 ohm resistors connected in a series? a. 20 ohms b. 120 ohms c. 60 ohms d. 180 ohms
Answers: 2
![question](/tpl/images/cats/informatica.png)
Computers and Technology, 24.06.2019 00:40
What is the error in the following pseudocode? module main() call raisetopower(2, 1.5) end module module raisetopower(real value, integer power) declare real result set result = value^power display result end module
Answers: 1
![question](/tpl/images/cats/informatica.png)
Computers and Technology, 24.06.2019 16:50
Ramp charts are generally created in wordlotusexcelpowerpoint
Answers: 1
You know the right answer?
In this exercise, we are going to create a static class Randomizer that will allow users to get rand...
Questions
![question](/tpl/images/cats/istoriya.png)
![question](/tpl/images/cats/mat.png)
Mathematics, 15.06.2020 22:57
![question](/tpl/images/cats/istoriya.png)
History, 15.06.2020 22:57
![question](/tpl/images/cats/istoriya.png)
History, 15.06.2020 22:57
![question](/tpl/images/cats/mat.png)
![question](/tpl/images/cats/mat.png)
Mathematics, 15.06.2020 22:57
![question](/tpl/images/cats/fizika.png)
Physics, 15.06.2020 22:57
![question](/tpl/images/cats/mat.png)
Mathematics, 15.06.2020 22:57
![question](/tpl/images/cats/obshestvoznanie.png)
Social Studies, 15.06.2020 22:57
![question](/tpl/images/cats/health.png)
Health, 15.06.2020 22:57
![question](/tpl/images/cats/en.png)
![question](/tpl/images/cats/en.png)
![question](/tpl/images/cats/mat.png)
Mathematics, 15.06.2020 22:57
![question](/tpl/images/cats/mat.png)
![question](/tpl/images/cats/geografiya.png)
Geography, 15.06.2020 22:57
![question](/tpl/images/cats/mat.png)
![question](/tpl/images/cats/mat.png)
![question](/tpl/images/cats/biologiya.png)
Biology, 15.06.2020 22:57
![question](/tpl/images/cats/istoriya.png)
History, 15.06.2020 22:57
![question](/tpl/images/cats/mat.png)
Mathematics, 15.06.2020 22:57