Beefy Boxes and Bandwidth Generously Provided by pair Networks
Do you know where your variables are?
 
PerlMonks  

Re: Generate a # between 1 and 50 in groups of 5

by Not_a_Number (Prior)
on Jan 30, 2015 at 22:15 UTC ( [id://1115149]=note: print w/replies, xml ) Need Help??


in reply to Generate a # between 1 and 50 in groups of 5

Here's yet another way. The difference is that it will avoid duplicates of a given number in your "groups of 5."

use List::Util 'shuffle'; my @shuffled = shuffle ( 1 .. 50 ); print join ' ', splice( @shuffled, 0, 5 ), "\n" for 1 .. 5;

Log In?
Username:
Password:

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

How do I use this?Last hourOther CB clients
Other Users?
Others taking refuge in the Monastery: (3)
As of 2024-04-20 01:43 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found