Here's the idiomatic Ruby:
5.times do
puts (1..7).map { [0, 1].sample }.join
end
Let me unzip it:
5.times do...endpretty clear. Do something between doand endfive times.
(1..7) . , . map , . [0, 1].sample . sample, , 0, 1. .join . .join('-'), , (1-0-0-1-1-1-0-1). , (10011101).
.
, , . , Ruby Way. , " - ", , Ruby. , , . ", - , 7- ... 0s 1s... ". ( map ( )).