Use sample instead of Random.rand

Co-authored-by: syeopite <70992037+syeopite@users.noreply.github.com>
This commit is contained in:
Émilien (perso) 2024-11-05 15:31:21 +01:00 committed by Emilien
parent 2cc204a045
commit 1c9f5b0a2b

View File

@ -648,7 +648,7 @@ module YoutubeAPI
puts "invidious companion section" puts "invidious companion section"
puts invidious_companion_urls[Random.rand(invidious_companion_urls.size)] puts invidious_companion_urls[Random.rand(invidious_companion_urls.size)]
begin begin
invidious_companion_response = make_client(URI.parse(invidious_companion_urls[Random.rand(invidious_companion_urls.size)]), invidious_companion_response = make_client(URI.parse(invidious_companion_urls.sample),
&.post(endpoint, headers: headers, body: data.to_json)) &.post(endpoint, headers: headers, body: data.to_json))
body = invidious_companion_response.body body = invidious_companion_response.body
if (invidious_companion_response.status_code != 200) if (invidious_companion_response.status_code != 200)