How you generate a list of discount codes in your store depends on which platform you’re using. For Shopify you can use their bulk discount app. They’ve written a guide on how to use it:
When you’ve created a discount set in the bulk discount app you can choose to export it to a CSV file. Once you have a list of codes you can open the Add Codes tab and choose to import a file (.csv).