Beefy Boxes and Bandwidth Generously Provided by pair Networks
Perl-Sensitive Sunglasses
 
PerlMonks  

Re: A Question with Nesting Arrays

by Kenosis (Priest)
on Dec 06, 2013 at 19:02 UTC ( #1066044=note: print w/ replies, xml ) Need Help??


in reply to A Question with Nesting Arrays

...I am a bit confused...

Me too, but I may not have had enough coffee, yet.

I don't see that your program's strictly doing what you want it to do, i.e., forming a new order of these strings, since you could be randomly selecting the same element from @X_info multiple times, creating a new set of strings (but perhaps that's what you do want).

However, if your goal is to randomly shuffle the array of strings n times, while maintaining that set of strings, then consider the following:

use warnings; use strict; use List::Util qw/shuffle/; my $runs = 1000; my $range = 1553; my @array = ( 'A' .. 'Z' ); @array = shuffle @array for 1 .. $runs * $range; print "@array";

Output:

E I C M P Y D B F Q U J X R V T Z H S N G A O W K L

Hope this helps!


Comment on Re: A Question with Nesting Arrays
Select or Download Code

Log In?
Username:
Password:

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

How do I use this? | Other CB clients
Other Users?
Others studying the Monastery: (11)
As of 2014-12-29 13:59 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    Is guessing a good strategy for surviving in the IT business?





    Results (188 votes), past polls