Beefy Boxes and Bandwidth Generously Provided by pair Networks
No such thing as a small change

Random Array Slice

by chromatic (Archbishop)
on Jul 10, 2000 at 21:45 UTC ( #21833=note: print w/replies, xml ) Need Help??

in reply to RE: RE: Random number
in thread Random number

It's not too tricky. The rand statement imposes a scalar context on @Chars, so it gets a random number bounded by the number of elements in the array.

The map statement creates a 30 element list of those random numbers.

That list is used as indexes into an array slice. (That means that the second argument to the join statement is a random set of 30 characters from the @Chars array.) They're joined into a string.

Log In?

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

How do I use this? | Other CB clients
Other Users?
Others chanting in the Monastery: (4)
As of 2022-09-27 16:58 GMT
Find Nodes?
    Voting Booth?
    I prefer my indexes to start at:

    Results (122 votes). Check out past polls.