added randomized initialization