generate the random secret key

refer to the book of railstutorial

http://railstutorial-china.org/chapter3.html#section-3-2