Forum Discussion
Ninjai_DI_67376
Nimbostratus
Aug 07, 2006Help,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_18Historic F5 AccountI've used "rand" tcl function before with good results. This code:
generates 7 or 8 digit numbers.[expr { int(100000000 * rand()) }]
- Ninjai_DI_67376
Nimbostratus
Thanks - TimRiker
Cirrocumulus
The length will vary from 1 to 8 characters, but short values are uncommon.
Recent Discussions
Related Content
DevCentral Quicklinks
* Getting Started on DevCentral
* Community Guidelines
* Community Terms of Use / EULA
* Community Ranking Explained
* Community Resources
* Contact the DevCentral Team
* Update MFA on account.f5.com
Discover DevCentral Connects