0
How do you generate integer i such that 10 =< i <= 50 ?
Generating random numbers
4 Réponses
+ 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);
}
}
}
+ 1
Which language?
0
By java
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