some algorithm of random, write in golang