Discount Voucher Lottery on Receipt

I want to offer a discount code lottery on receipts.

So say per day I want to commit to giving away:

2x 50% off voucher
4x 20% off voucher
15x 10% off voucher

Shown as a barcode on the receipt. This could be based on probability or average daily order volume.

Can anyone point out how this might be possible?

Can you elaborate on your thoughts on how this might work?
How its claimed/won?

For every order, say there’s a 1:10 chance of a 10% discount voucher on return visit, being printed on a receipt at time of payment.

The voucher being in the form of a barcode which is scanned when paying the next order, resulting in said discount.

Creating a barcode to scan and discount is fairy simple, ive done a tutorial on it if you search Ricks tutorials

The harder part is having is randomly print 10% of time

What would be easier is a separate ticket template just with the discount voucher with barcode on, then set that to print at certain times, maybe every 20 tickets or something. It’s a little less random as it will happen every 20 but would be easier to do

You could generate a random number between 1 and 10 a d print if it = 1.