#!/usr/bin/ruby

#
## Translation of: http://rosettacode.org/wiki/Knuth_shuffle#Perl
#

func shuffle (a) {

    { |n|
        var k = (n -> irand);
        k == n || (a[k, n] = a[n, k]);
    } * a.len;

    return a;
}

say shuffle(1..10 -> to_a);
