Stefan: It's probably because the random seed has been initialized in the 
parent process. See http://perldoc.perl.org/5.10.1/functions/srand.html for 
more details.

You could try to call srand in each chile process:

  sub startup {
    my $app = shift;
    # this code is run in parent process

    # this next_tick() code is run once in each forked child
    Mojo::IOLoop->next_tick(sub { srand });
  } 

On Thursday, August 21, 2014 8:00:05 AM UTC+2, Stefan Adams wrote:
>
> I have a template:
>
> % use List::Util 'shuffle';
> % my @roster = shuffle @$roster;
>
> And when using hypnotoad I don't get a new randomized roster list on every 
> page refresh.  It seems that I have about 4 possible randomized lists that 
> my browser may display, presumale because I have 4 hypnotoad processes 
> running and handling requests.
>
> I assume this is expected.  What can I do to get the behavior that I'm 
> looking for which is a randomized list on every page refresh?
>
> Naturally, with morbo, it's a new randomized list on every page refresh.
>  

-- 
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