Randomize User-Agent Strings

What I am looking to do is randomize the user-agent string of requests. I know that this can be handled by a Downloader Middleware and even in the Spider itself. Would the following code set a random user-agent string for each Selenium request or would I have to do this in a Downloader Middleware?

import random
from selenium.webdriver.support import expected_conditions as EC
from selenium import webdriver
from selenium.webdriver import Firefox

class MySpider(CrawlSpider):
    ua_strings = [
        'Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/67.0.3396.99 Safari/537.36',
        'Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/67.0.3396.87 Safari/537.36',
        'Mozilla/5.0 (Windows NT 10.0; Win64; x64; rv:60.0) Gecko/20100101 Firefox/60.0',
        'Mozilla/5.0 (Macintosh; Intel Mac OS X 10_13_5) AppleWebKit/605.1.15 (KHTML, like Gecko) Version/11.1.1 Safari/605.1.15',
        'Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/66.0.3359.181 Safari/537.36',
        'Mozilla/5.0 (Windows NT 6.1; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/67.0.3396.87 Safari/537.36',
        ...
    ]

    custom_settings = {
        'USER_AGENT' = random.choice(ua_strings)
    }

    hrefs = WebDriverWait(browser, 60).until(
        EC.visibility_of_all_elements_located((By.XPATH, '//div[@class="discoverableCard"]/a'))
    )

    links = []

    def parse(self, response):
        options = Options()
        options.add_argument('-headless')
        browser = webdriver.Firefox(firefox_options=options)
        browser.get(self.start_urls[0])

        for href in hrefs:
            links.append(href.get_attribute('href'))

        for link in links:
            browser.get(item)
            """ scrape each page """