httpd-test-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Jacek Prucia <jacek.pru...@acn.waw.pl>
Subject fixed range for random variables
Date Wed, 12 May 2004 13:37:12 GMT

Really nifty flood feature is the ability to initialize variable to
random value. Using following construct: ${=name} inside
requesttemplate causes flood to create variable 'name', and assign it
a value obtained by calling rand/lrand48/random. Consider a typical
scenario, where you would like to fetch some item (say article) from
database using random index. Here's an example:

responsetemplate="http://www.example.com/getArticle?id={=art_id}

The problem is that range for random values is 0 - RAND_MAX
(which is 2147483647 on my system). Not every database out there can be
proud to have (calls random...) 27667 articles handy. So we need fixed
range for random variables, which is what I have already written. The
problem is how we integrate this into flood.

Right now the range can be specified as:

   5:24
 -12:79
    :41   (means 0:41)
 123:     (means 123:RAND_MAX)

Natural choice would be to use following construct for assigning fixed
range:

${5:24=name}

This just extends existing concept, but also look's kinda odd. I would
like to replace it with more general syntax:

${name=rand(5:24)}

Is it okay with everybody? Please speak up if that violates anything.

regards
--
Jacek Prucia


Mime
View raw message