[Date Prev][Date Next][Thread Prev][Thread Next][Interchange by date
][Interchange by thread
]
[ic] random_string() persistant?
At 04:12 PM 10/11/2002 -0700, you wrote:
> > >I'm using the random_string() function in a usertag called
> > >random_string_value.
> > >
> > >Looks like this:
> > >
> > >UserTag random_string_value Order tag
> > >UserTag random_string_value Routine <<EOR
> > >sub {
> > >return random_string();
> > >}
> > >EOR
> > >
> > >Accessed like this:
> > >
> > >[random_string_value]
> > >
> > >The problem is that if I access a page with this on it, it is random the
> > >first time, but subsequent accesses render a non-unique string
> > that is the
> > >same as the one before it.
> > >
> > >Any ideas?
> >
> > Does WFM count? :-) You can look through the code underneath it to find
> > out what is causing the problem, but I think you will find that
> > it is only
> > random for every second that passes (i.e. you have to wait one second to
> > get another random value). HTH,
> >
> > --
> > /~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~\
> > | Dan Browning, Kavod Technologies <dan.browning@kavod.com> |
> > | (360) 882-7872 x7, 6700 NE 162nd Ave, Suite 210, Vancouver, WA |
> > \~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~/
>
>Dan,
>
>What's WFM? Thank you, but I don't think that's it.
WFM means Works For Me. And it does. My tag is basically the same as yours:
UserTag random_string Order length
UserTag random_string Routine <<EOF
sub {
my ( $length ) = @_;
$length = 14 unless $length;
return Vend::Util::random_string($length);
}
EOF
Perhaps rand() isn't random on your platform for some reason -- or
something else is going on here.
--
/~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~\
| Dan Browning, Kavod Technologies <dan.browning@kavod.com> |
| (360) 882-7872 x7, 6700 NE 162nd Ave, Suite 210, Vancouver, WA |
\~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~/
Test-tube babies shouldn't throw stones.