Fixed a bug in rand_amplify()