Okay so here's a revised version with upper limit as an input.

If you select an upper limit of anywhere 30-39 you'll get 4 lines to play and if numbers come out larger than your limit it'll wrap around starting at 1.

If you select an upper limit of anywhere 40-49 you'll get 5 lines to play and larger numbers than your limit will also wrap around starting at 1.

For example if your limit is 37, and a 38 came up in system, it'll wrap around and become 1.