提交 2b6bacd1 编写于 作者: E Erik Michaels-Ober

Replace Array#shuffle.first with Array#sample

上级 996aab57
......@@ -88,13 +88,13 @@ def visualizer(paths, title = 'FSM')
erb = File.read File.join(viz_dir, 'index.html.erb')
states = "function tt() { return #{to_json}; }"
fun_routes = paths.shuffle.first(3).map do |ast|
fun_routes = paths.sample(3).map do |ast|
ast.map { |n|
case n
when Nodes::Symbol
case n.left
when ':id' then rand(100).to_s
when ':format' then %w{ xml json }.shuffle.first
when ':format' then %w{ xml json }.sample
else
'omg'
end
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册