Working train1.txt file. Random group selection was failing. Fixed now.
Working version in dolphins network. Is far more  faster than original code... :S. Decorrelation step not being used and also temp output is commented so I think both codes are in same conditions... This sounds nice.