@malibor, Your Generate function is misleading as it's interface suggests you can call it multiple times with different start and end values. But in fact it will only use the values passed on the first call.
You must also ensure that start <= end (maybe swap them if not).