dbader / schedule

Python job scheduling for humans.
https://schedule.readthedocs.io/
MIT License
11.77k stars 961 forks source link

Random schedule doesn't work with floats #593

Open Christophe-Foyer opened 1 year ago

Christophe-Foyer commented 1 year ago

Hi!

I was just trying to get the scheduler to schedule things at random frequencies after than 1 time a second. I don't actually care too much about it being perfect, just a useful library to schedule things.

This line is making that impossible: https://github.com/dbader/schedule/blob/master/schedule/__init__.py#L715

Would it be possible to replace the logic with a (maxval-minval)*random.random()+minval maybe? I imagine that's what randrange does internally (or something similar). The only concern is this would be changing the behavior from only integer values being output to non integer values.