The Perl Toolchain Summit needs more sponsors. If your company depends on Perl, please support this very important event.

NAME

Data::Randr - numeral randomizer for a cache expires time

SYNOPSIS

    use Data::Randr qw/randr/;

    randr(10);        # 9 - 11
    randr(10, 20);    # 8 - 12
    randr(10, 20, 4); # 8.0000 - 11.9999 down to 4 decimal places, ex. 8.4321

or OOP style

    use Data::Randr;

    my $rdr = Data::Randr->new(rate => 20, digit => 2);
    $rdr->randr(10); # 8.00 - 11.99

DESCRIPTION

Data::Randr gives random number for a cache expires time to avoid the thundering herd problem.

METHOD

new(%args)

constructor

construct options

rate : int // 10

randomize rate(1 - 100)

digit : int // 0

decimal number

randr($number[, $rate, $digit])

response randomized number

Like below, $res is 8.0000 - 11.9999.

    my $res = randr(
        10, # base number
        20, # randomize rate for base number
        4,  # decimal number
    );

REPOSITORY

Data::Randr is hosted on github: http://github.com/bayashi/Data-Randr

I appreciate any feedback :D

AUTHOR

Dai Okabayashi <bayashi@cpan.org>

LICENSE

This module is free software; you can redistribute it and/or modify it under the same terms as Perl itself. See perlartistic.