Question : generate float array in ruby
Answered by : talaatmagdy
-1.25.step(by: 0.5, to: 1.25).to_a
# => [-1.25, -0.75, -0.25, 0.25, 0.75, 1.25]
Source : https://stackoverflow.com/questions/32221652/create-array-in-ruby-with-begin-value-end-value-and-step-for-float-values | Last Update : Tue, 01 Mar 22