Forum OpenACS Q&A: Response to Coding: db vs tcl: Fastest Random Loop

Collapse
Posted by Jerry Asher on
It sounds as though you want a random draw from a deck without replacement, as opposed to just a random number.  That's a bit more difficult to describe while my girls eat their breakfast, so I'll let you implement that one on your own.

You might consider however, do you really require the displays to be randomly arranged on each presentation, or do you just want them to be different?  If the latter, you could have your server predetermine the display orders just once, and then use cookie technology or what have you to determine where in the sequence each visitor is.  That might be less cpu intensive (although neither is probably a big deal.)

And yes, procs in your tcl lib (usually /tcl) persist through each connection.  The tradeoff is that the cumulative total of all your /tcl procs makes aolserver a bit bigger and a bit slower to start each thread.