basic logic of random