View Single Post
  #2  
Old 05-14-2009, 02:08 PM
mistwang mistwang is offline
LiteSpeed Staff
 
Join Date: May 2003
Location: New Jersey
Posts: 7,590
I think it is the rand() function in Rails, the random generator has been initialized only once when the Rails Application starts, then RailsRunner for LSWS will fork() from the parent process, to process a request, then exit if idle for a while, then fork() another process when a new request comes in a while later. The random number generator has the same state for both children processes, so they produce the same random number.

The solution is to initialize the rondom number generator again before calling rand() function. In C it is srand() function, not sure what it is in Ruby.
Reply With Quote