Random Numbers in Array

Run Settings
LanguageJava
Language Version
Run Command
import java.util.Random; class Main { public static void main(String[] args) { //SETUP RANDOM AND B ARRAY Random rand = new Random(); int bVals[ ] = new int[5]; //GENERATE 5 RANDOM NUMBERS for (int i = 0; i < 5; i ++){ int n = rand.nextInt(50) + 1; bVals[i] = n; } //PRINT 5 RANDOM NUMBERS TO VERIFY for (int x = 0; x < 5; x++) System.out.println(bVals[x]); } }
Editor Settings
Theme
Key bindings
Full width
Lines