generate the random secret key

refer to <<railstutorial>>

http://railstutorial-china.org/chapter3.html#section-3-2