Skip to content

Instantly share code, notes, and snippets.

@Songmu
Created March 8, 2012 02:53
Show Gist options
  • Save Songmu/1998244 to your computer and use it in GitHub Desktop.
Save Songmu/1998244 to your computer and use it in GitHub Desktop.
#!/usr/bin/env perl
use 5.12.0;
use warnings;
use utf8;
use YAML;
use List::Util qw/shuffle/;
my $arr = [1..50];
my $split_unit = 10;
warn Dump sub {
my ($arr, $split_unit) = @_;
my @arr = @$arr; #copy
my @ret;
push @ret, [splice @arr, 0, $split_unit] while @arr;
[map {@$_ = shuffle @$_;@$_} @ret]
}->($arr, $split_unit);
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment