All possible combinations from a hash of arrays in Ruby

后端 未结 4 2000
忘掉有多难
忘掉有多难 2021-02-05 08:01

What I have:

Let\'s say I have a hash like this, with various values belonging to one parameter.

a = {}
a[:bitrate] = [\"100\", \"500\", \"1000\"]
a[:f         


        
4条回答
  •  -上瘾入骨i
    2021-02-05 08:20

    Please try OCG options combination generator.

    require "ocg"
    
    generator = OCG.new(
      :bitrate => %w[100 500 1000],
      :fps => %w[15 30],
      :qp => %w[20 30]
    )
    
    puts generator.next until generator.finished?
    

    Generator includes much more functionality that will help you to deal with other options.

提交回复
热议问题