new logic system

now, random numbers are generated only for first line, next number is
generated from other available numbers