Skip to content

Commit

Permalink
Replace Array#shuffle.first with Array#sample
Browse files Browse the repository at this point in the history
  • Loading branch information
sferik committed Oct 13, 2014
1 parent 996aab5 commit 2b6bacd
Showing 1 changed file with 2 additions and 2 deletions.
Expand Up @@ -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
Expand Down

0 comments on commit 2b6bacd

Please sign in to comment.