checking in alogrithm
working now, and rnd function added