> Create a program using array statement, that should be output 30000 numbers randomly.?

Create a program using array statement, that should be output 30000 numbers randomly.?

Posted at: 2014-12-18 
What's the array for? You can output those number without using 30,000 words of memory to hold all of them.

Also, what language?

What sort of "randomly" did you have in mind? You could shuffle the numbers from 1 to 30,000 into random order and output those. That would require an array of some sort.

On the other hand, 30,000 dice rolls would be random, but the numbers would be 1-6 will a lot of duplication (or 2-12 with an uneven distribution for rolling two dice, also with lots of duplication.)

Python could do this in four lines:

import random

nums = [i+1 for i in range(30000)]

random.shuffle(nums)

print(", ".join(str(n) for n in nums)

That builds a list of the numbers 1 through 30,000, then shuffles them and then prints them on a single line separated by commas.

The syntax is designed to work with either Python 2 or 3.

new myArray;

i = 0;

while i < 30000 {

myArray[i] = "numbers randomly";

i++;

}