Monday, 12 August 2013

Haskell random numbers suddenly start to "converge" after months of running

Haskell random numbers suddenly start to "converge" after months of running

I have a server program that randomly selects 10 network peers to
accomplish a task. The code that generates the random indices of the peers
is as follows:
indices = let index = getStdRandom $ randomR (0, number_of_peers)
in sequence $ replicate 10 index
The program has been running for months, generating thousands of `indices'
each day, and has been working fine until yesterday, when I noticed that
something has gone wrong: the random numbers generated seem to "converge"
to a few repeating values (the result is that the corresponding network
peers are heavily loaded).
To see the change, below is from the server log a few days ago:
peers selected:
[("r55",0),("r47",0),("r80",0),("r74",0),("r183",0),("r85",0),("r04",0),("r33",0),("r72",0),("r58",0)]
and the log from today's (as you can see, peer r53, r37 and r195 is
repeatedly selected):
peers selected:
[("r53",96003),("r53",96003),("r37",106272),("r37",106272),("r37",106272),("r37",106272),("r195",118616),("r195",118616),("r195",118616),("r21",140499)]
The program is running on an x86_64 version of Linux (Ubuntu 10.10, to be
exact).

No comments:

Post a Comment