BEGIN { my @list = 1..100; #or whatever; *CORE::GLOBAL::rand = sub { return shift @list } #or something }