ruby_light_map_creator.rb
# Picks a color from the parameter based on weight
Picks a color from the parameter based on weight
Picks a color from the parameter based on weight
def pick(weight_array)
    sum = 0
    weight_array.each { |param|
      sum += param[0]
    }
    ran = Random.new.rand(0..sum)
    weight_array.binary_search { |v| ran <=> v[0] }
  end
def pick ( weight_array ) sum = 0 weight_array . each { | param | sum += param [ 0 ] } ran = Random . new . rand ( 0 .. sum ) weight_array . binary_search { | v | ran <=> v [ 0 ] } end
Picks a color from the parameter based on weight
Picks a color from the parameter based on weight
weight_array
<not_specific>