generate a random long in case threadId fails to be created