[OT] programming question

Nicholas Clark nick at ccl4.org
Thu May 3 11:03:30 BST 2007


On Thu, Apr 26, 2007 at 02:00:51PM +0100, Andy Armstrong wrote:
> On 26 Apr 2007, at 13:45, Nicholas Clark wrote:
> >On Thu, Apr 26, 2007 at 01:08:21PM +0100, Andy Armstrong wrote:
> >
> >>Is the thing I posted using List::Util::shuffle after seeding the RNG
> >>no use?
> >
> >No, it's just that I haven't tried it yet. Mainly because so far no  
> >code
> >is written. This may change, depending on how many other things I  
> >want to
> >procrastinate on.
> 
> Should we organise a procrastination rota and formalise the whole  
> allocation of displacement activities thing? I confess that I've  
> probably used more than my fair share lately.

Well, I was procrastinating with this:

  http://plum.flirble.org/~nick/branes.cgi

which is now available for everyone else to procrastinate with.


On Thu, Apr 26, 2007 at 01:29:13AM +0100, Andy Armstrong wrote:

> Or perhaps:
> 
> use List::Util qw(shuffle);
> 
> my $MAX_ID = 5;
> my $SEED   = 123;
> 
> srand($SEED);
> my @order = shuffle( 1 .. $MAX_ID );

This worked a treat. Although (obviously) the seed for any particular ordering
comes from somewhere repeatable.

A side effect is that the "random" next question you get is determined by
the seed for the previous answer order, which means that you get some slightly
surprising repeatability if you go back and re-answer questions.

Nicholas Clark


More information about the london.pm mailing list