Forum Discussion
Robert_Sutcliff
Nimbostratus
Dec 03, 2009How random is rand()?
Hi,
How random is the tcl rand function?
We're currently using it to generate a unique(ish) value for each request we process - using a code bloc like this
se...
Robert_Sutcliff
Nimbostratus
Dec 04, 2009A solution I've come up with is to use a STATS profile.
Then for every connection (on every vhost) we can increment a counter. The code snippet then becomes
set iruleversion [format "%04X" 1]
set F5id "[format "%02X" 1]"
STATS::incr Booking_stats request_count
set rnum [format "%08X" [STATS::get Booking_stats request_count] ]
set cthash [format "%08X" [clock seconds] ]
set tracker "$F5id$iruleversion$cthash$rnum"
This allows us to identify the BigIP pair (F5id) the request was processed by, and gives us a version number (iruleversion) for the iRule, which together with the clock should ensure we don't get duplicate values if/when the Booking_stats profile is reset.
Unfortunately the F5id and iruleversion need manual control, but as I don't think we'll be updating either frequently this isn't a problem.
Rob
Help guide the future of your DevCentral Community!
What tools do you use to collaborate? (1min - anonymous)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
