Update random id generation algorithm