[lib] add randNum and remove duplicated rDelay functions