Using rand or Random for security tokens produces predictable values.
Generate tokens with SecureRandom.hex or SecureRandom.uuid.