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


i have server program randomly selects 10 group of network peers accomplish task. code generates random indices of peers follows:

indices = let index = getstdrandom $ randomr (0, number_of_peers - 1)           in sequence $ replicate 10 index 

the program has been running months, generating thousands of `indices' each day, , has been working fine until yesterday, when noticed has gone wrong: random numbers generated seem "converge" few repeating values (the result corresponding network peers heavily loaded).

to see change, below server log few days ago:

peers selected: [55,47,80,74,183,85,04,33,72,58]  

and log today's (as can see, peer 53, 37 , 195 repeatedly selected):

peers selected: [53,53,37,37,37,37,195,195,195,21]  

the program running on x86_64 version of ubuntu 10.10.

after investigation turns out embarrassing bug of own: root user on server has limit of maximum open files of 1024, unexpectedly low (but heard default on ubuntu). when server program has many open sockets, part of system starts reject peers, making status 'inactive'. actual 'indices' is:

indices = let index = getstdrandom $ randomr (0, m.size active - 1) in               sequence $ replicate (n * 2) index 

i'm sorry if question causing trouble or confusion. i'll try post more prudently next time.


Comments

Popular posts from this blog

ios - UICollectionView Self Sizing Cells with Auto Layout -

node.js - ldapjs - write after end error -

DOM Manipulation in Wordpress (and elsewhere) using php -