Bernhard's suggestion doesn't solve the problem. What you need to do is 
write this in your startup routine:




*use Mojo::IOLoop;Mojo::IOLoop->next_tick(sub{    srand;});*

This trick documented here:  
https://metacpan.org/pod/distribution/Mojolicious/lib/Mojolicious/Guides/Cookbook.pod#Built-in-web-server
  
near the end of the chapter

On Sunday, March 18, 2012 8:00:48 PM UTC+2, Bernhard Graf wrote:
>
> > I have an issue with rand().
> >
> > In all forked processes rand() gives me the same set of random
> > symbols. May be call srand() after forking? How to do it correctly?
>
> You rand() before Hypnotoad forks, so all processes share the same seed.
>
> Move your (s)rand outside startup() into a has/helper declaration.
>
> HTH
>
> Bernhard
>
>

-- 
You received this message because you are subscribed to the Google Groups 
"Mojolicious" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
To post to this group, send email to [email protected].
Visit this group at http://groups.google.com/group/mojolicious.
For more options, visit https://groups.google.com/d/optout.

Reply via email to