Mojo-Collection-Role-UtilsBy

 view release on metacpan or  search on metacpan

t/lib/Unrandom.pm  view on Meta::CPAN


use Exporter 'import';
our @EXPORT = qw( unrandomly );

our $randhook;
*CORE::GLOBAL::rand = sub { $randhook ? $randhook->( $_[0] ) : rand @_ };

use constant VALUE => 0;
use constant BELOW => 1;

sub unrandomly(&)
{
   my $code = shift;

   my @rands;
   my $randidx;
   local $randhook = sub {
      my ( $below ) = @_;
      if( $randidx > $#rands ) {
         push @rands, [ 0, $below ];
         $randidx++;



( run in 0.350 second using v1.01-cache-2.11-cpan-49f99fa48dc )