Check out example codes for "generate 6 digit random number ruby". It will help you in understanding the concepts better.

Code Example 1

10.times.map{rand(10)}.join # => "3401487670"

Learn ReactJs, React Native from akashmittal.com