If I have a number from 0 to 70, then I want to add five random numbers and random numbers. So be 140 and less 220 then. I want to do this as long as the number of five random numbers does not occur at 140..220, and then display those five random numbers. * I have done so far: or: If you need a real number from the sum, then its Use liner: can be repeated, then use it instead: Multiline edition of another, with a state error (cap tip sumual):
5.times {r = rand (0 .. 70); Puts "# {r}"}
5.times {puts "# {[* ... ... 70] Sample} "}
nums = [* 0 ... 70]. Sample (5) Unless (140..220) === (nums || []). If injected (: +)
nums = 5times.collect {rand (0 .. 70)} till (140 ..220) === (nums || []). Injection (: +)
points = [] Valid = 140..220 Not valid until === Points-indject (+) = [] 5. Times {points> lt; & Lt; Rand (0 .. 70)} and
No comments:
Post a Comment