read file and random gen. initial state