Random id generation

add random id generation and set a while loop