Make type casts safer.
fix #1823
implement Array#sample in mruby-random gem
refactoring mruby-random
add data_type check to mruby-random
Merge pull request #1832 from ksss/fix-1823

fix #1823
Merge pull request #1831 from monaka/pr-make-type-casts-safer

Make type casts safer