remove WebGUI::Utility::randint

This commit is contained in:
Graham Knop 2010-08-20 12:58:50 -05:00
parent ff70751bc5
commit cb938487cb
3 changed files with 2 additions and 35 deletions

View file

@ -182,7 +182,7 @@ sub gateway {
my $url = $self->make_urlmap_work($self->session->config->get("gateway")).'/'.$pageUrl;
$url =~ s/\/+/\//g;
if ($self->session->setting->get("preventProxyCache") == 1 and !$skipPreventProxyCache) {
$url = $self->append($url,"noCache=".randint(0,1000).':'.time());
$url = $self->append($url,"noCache=".int(rand(1001)).':'.time());
}
if ($pairs) {
$url = $self->append($url,$pairs);

View file

@ -23,7 +23,7 @@ use Net::CIDR::Lite;
our @ISA = qw(Exporter);
our @EXPORT = qw(&isInSubnet
&sortHash &isIn &randint &round
&sortHash &isIn &round
);
@ -40,7 +40,6 @@ This package provides miscellaneous but useful utilities to the WebGUI programme
use WebGUI::Utility;
$boolean = isIn($value, @array);
$boolean = isInSubnet($ip, \@subnets);
$integer = randint($low,$high);
$rounded = round($number, $digits);
%hash = sortHash(%hash);
@ -117,30 +116,6 @@ sub isInSubnet {
#-------------------------------------------------------------------
=head2 randint ( low, high )
Returns an integer between the low and high number.
=head3 low
The lowest possible value. Defaults to 0.
=head3 high
The highest possible value. Defaults to 1.
=cut
sub randint {
my ($low, $high) = @_;
$low = 0 unless defined $low;
$high = 1 unless defined $high;
($low, $high) = ($high,$low) if $low > $high;
return $low + int( rand( $high - $low + 1 ) );
}
#-------------------------------------------------------------------
=head2 round ( float [, significantDigits ] )
Returns an integer after rounding a floating point number.

View file

@ -26,14 +26,6 @@ my $session = WebGUI::Test->session;
ok(WebGUI::Utility::isIn("webgui", qw(cars trucks webgui trains)), 'isIn()');
# randint
my $number = WebGUI::Utility::randint(50,75);
ok($number >= 50 && $number <= 75, 'randint()');
$number = WebGUI::Utility::randint();
ok($number >= 0 && $number <= 1, 'randint() with default params');
my $number = WebGUI::Utility::randint(10,5);
ok($number >= 5 && $number <= 10, 'randint() auto reverses params if they are backwards');
# round
is(WebGUI::Utility::round(47.133984233, 0), 47, 'round() - 0 significant digits');
is(WebGUI::Utility::round(47.133984233, 3), 47.134, 'round() - multiple significant digits');