Improved the random generation of secret.