From 7033959b5e8e92a81c5a370ecb992ee5f9f74d1d Mon Sep 17 00:00:00 2001 From: Colin Kuskie Date: Sun, 23 Jul 2006 06:17:31 +0000 Subject: [PATCH] Add more docs to the Splat_random macro. Change the macro to use Perl's scaling function of rand instead of an implicit multiply. --- lib/WebGUI/Macro/Splat_random.pm | 7 ++++--- lib/WebGUI/i18n/English/Macro_Splat_random.pm | 4 ++-- 2 files changed, 6 insertions(+), 5 deletions(-) diff --git a/lib/WebGUI/Macro/Splat_random.pm b/lib/WebGUI/Macro/Splat_random.pm index c5d819b34..c1e982b67 100644 --- a/lib/WebGUI/Macro/Splat_random.pm +++ b/lib/WebGUI/Macro/Splat_random.pm @@ -35,13 +35,14 @@ used as a default. #------------------------------------------------------------------- sub process { my $session = shift; - my ($temp, @param); + my ($temp, @param, $limit); @param = @_; if ($param[0] ne "") { - $temp = round(rand()*$param[0]); + $limit = $param[0]; } else { - $temp = round(rand()*1000000000); + $limit = 1000000000; } + $temp = round(rand($limit)); return $temp; } diff --git a/lib/WebGUI/i18n/English/Macro_Splat_random.pm b/lib/WebGUI/i18n/English/Macro_Splat_random.pm index 61cca73fa..d4ec83789 100644 --- a/lib/WebGUI/i18n/English/Macro_Splat_random.pm +++ b/lib/WebGUI/i18n/English/Macro_Splat_random.pm @@ -16,10 +16,10 @@ our $I18N = { message => q|

^*; or ^*(); - Random Number
-A randomly generated number. This is often used on images (such as banner ads) that you want to ensure do not cache. In addition, you may configure this macro like this ^*(100); to create a random number between 0 and 100. +A randomly generated, whole number between 0 and the number you send the Macro. This is often used on images (such as banner ads) that you want to ensure do not cache. You may configure this macro like this ^*(100); to create a random number between 0 and 100. If no number is sent a default of 1 billion (1,000,000,000) will be used.

|, - lastUpdated => 1146608648, + lastUpdated => 1153635269, }, };