Write a program to generate 1,000,000 random numbers in an array

Untitled Forums Programming Assignment Help Write a program to generate 1,000,000 random numbers in an array

Viewing 3 posts - 1 through 3 (of 3 total)
  • Author
    Posts
  • #15753
    aastha
    Member

    Write a program to generate 1,000,000 random numbers in an array.

    #15754
    kingsly
    Participant

    in php

    $randomNumbersArray = giveRandNumber(1000000);

    function giveRandNumber($count)
    {
    $array = array();
    for($i = 0; $i <= $count; $i++) {
    $array[] = mt_rand();
    }
    }

    #15755
    kingsly
    Participant

    in Python

    import random

    def onemillion_rand(count):
    return random.sample(range(1, 10000000),count)

    print(onemillion_rand(1000000))

Viewing 3 posts - 1 through 3 (of 3 total)
  • You must be logged in to reply to this topic.