Forum Discussion

Ninjai_DI_67376's avatar
Ninjai_DI_67376
Icon for Nimbostratus rankNimbostratus
Aug 07, 2006

Help,can i generate a random number using irule?

I want to generate a random number first,and then add this number to the end of http uri.

 

 

I have found a funtion in TCL Reference:

 

 

srand(arg)

 

The arg, which must be an integer, is used to reset the seed for the random number generator.

 

Returns the first random number from that seed. Each interpreter has it’s own seed.

 

 

But,how to use it?
  • Deb_Allen_18's avatar
    Deb_Allen_18
    Historic F5 Account
    I've used "rand" tcl function before with good results. This code:
    [expr { int(100000000 * rand()) }]
    generates 7 or 8 digit numbers.

     

     

    HTH

     

    /deb
  • The length will vary from 1 to 8 characters, but short values are uncommon.