module Sequel
  module SchemaSharding
    module ConnectionStrategy
      class Random
        def self.choose(db, config)
          choice = rand(config['replicas'].size)
          config['replicas'][choice]
        end
      end
    end
  end
end

# This strategy is used for choosing a :read_only server
# to connect to.
#
# A random server will be chosen from the replica list
# for this physical shard.
module Sequel
  module SchemaSharding
    module ConnectionStrategy
      class Random
        def self.choose(db, config)
          config['replicas'].sample
        end
      end
    end
  end
end

Simplify ruby code by using sample instead of rand
Simplify ruby code by using sample instead of rand
