Beefy Boxes and Bandwidth Generously Provided by pair Networks
Your skill will accomplish
what the force of many cannot
 
PerlMonks  

Re^3: Make random numbers

by Eily (Monsignor)
on Dec 07, 2018 at 09:35 UTC ( [id://1226869]=note: print w/replies, xml ) Need Help??


in reply to Re^2: Make random numbers
in thread Make random numbers

I'm tempted to argue that the OP didn't mention wanting integer numbers between 1 and 1000 :P, but technically I did understand the same as you until I started thinking about an answer to your post :D. I didn't mention int on purpose for two reasons, I knew it was mentioned in the rand page, and I expected GHMON to come back here for corrections if the first attempt didn't work as expected.

Replies are listed 'Best First'.
Re^4: Make random numbers
by Marshall (Canon) on Dec 07, 2018 at 10:01 UTC
    I think the OP wanted integers (1..1000).
    I also expected a reply with some Perl code and an explanation of why it didn't "work".
    I think we are on the same page...

    If I get a response like "this worked", but it doesn't create an array and I haven't tried to do that...this will fall upon some very deaf ears.

    Update: I am probably not the only Monk who wonders what the OP is going to do with this array of numbers? Geez.. this function is not exactly a masterpiece of Computer Science. I have no idea of how this data will be used.

      I am probably not the only Monk who wonders what the OP is going to do with this array of numbers?

      In addition, I wondered whether someone should point out to the OP that solutions given so far provide pseudorandom (not random) numbers. But I decided (for my own convenience) that such considerations were not relevant to the exercise being undertaken.

      Cheers,
      Rob
        Yes, I also thought that pointing this out wouldn't be helpful to the OP. There are also "better" pseudo random algorithms than the standard rand() function - algorithms that give a more even distribution of numbers and do better on other statistical measures at the expense of more computational effort. I'm sure none of this matters to the OP. Basically given the hints provided, if the OP couldn't come close to my one Perl line, the chance of any significant computation using the results is close to zero.

        To get really random numbers, you need a piece of hardware that quantifies some physical random phenomenon. I haven't checked in on the Princeton EGG Project in awhile. I suspect that their hardware is pretty good.

        I wondered whether someone should point out to the OP that solutions given so far provide pseudorandom (not random) numbers

        ... except the solution provided by soonix of course, which produces a guaranteed random number ;-)

        TGIF, Rata

Log In?
Username:
Password:

What's my password?
Create A New User
Domain Nodelet?
Node Status?
node history
Node Type: note [id://1226869]
help
Chatterbox?
and the web crawler heard nothing...

How do I use this?Last hourOther CB clients
Other Users?
Others perusing the Monastery: (4)
As of 2024-03-29 14:46 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found