0

How do you generate integer i such that 10 =< i <= 50 ?

Generating random numbers

4th Jul 2020, 7:17 AM
[No Name]
[No Name] - avatar
4 ответов
+ 2
[No Name] some patience, play with the examples in the Java tutorial, finish it and then practice. If you need help in your concrete project after that, feel free to ask. import java.util.Random; public class Program { public static void main(String[] args) { Random rnd = new Random(); int result; for (int i=0; i<10; i++){ result = 10 + rnd.nextInt(40); System.out.println(result); } } }
4th Jul 2020, 9:20 AM
JaScript
JaScript - avatar
+ 1
Which language?
4th Jul 2020, 7:20 AM
Théophile
Théophile - avatar
0
By java
4th Jul 2020, 7:21 AM
[No Name]
[No Name] - avatar
0
Good! But the output will be sequencey just from 10 to 50 and just 40 numbers I mean output must be 50 randomly numbers begin from 10th
4th Jul 2020, 7:55 AM
[No Name]
[No Name] - avatar