fixing randon function