ruby koans 随机播放正在发生的事情
ruby koans shuffle what is happening
无法理解 ruby koans 中的这个。也许有人可以帮忙?The answers you seek...
undefined method
to_a_shuffle' for 1..5:Range
请思考以下代码:
/Users/nicholaskelly/koans/koans/about_dice_project.rb:12:在 roll'
/Users/nicholaskelly/koans/koans/about_dice_project.rb:24:in
test_rolling_the_dice_returns_a_set_of_integers_between_1_and_6'`
这里是 about_dice_project.rb12:
@values = (1..number).to_a_shuffle
没有名为 to_a_shuffle
的方法。您需要将 to_a
应用于一个范围,然后 shuffle
该数组。
@values = (1..number).to_a.shuffle
无法理解 ruby koans 中的这个。也许有人可以帮忙?The answers you seek...
undefined method
to_a_shuffle' for 1..5:Range
请思考以下代码:
/Users/nicholaskelly/koans/koans/about_dice_project.rb:12:在 roll'
/Users/nicholaskelly/koans/koans/about_dice_project.rb:24:in
test_rolling_the_dice_returns_a_set_of_integers_between_1_and_6'`
这里是 about_dice_project.rb12:
@values = (1..number).to_a_shuffle
没有名为 to_a_shuffle
的方法。您需要将 to_a
应用于一个范围,然后 shuffle
该数组。
@values = (1..number).to_a.shuffle