Skip to content

Instantly share code, notes, and snippets.

@revuel
Last active January 2, 2020 08:33
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save revuel/cc28f57485dfa11bec9ec174bf79fc9a to your computer and use it in GitHub Desktop.
Save revuel/cc28f57485dfa11bec9ec174bf79fc9a to your computer and use it in GitHub Desktop.
Generates random time intervals, for time reporting purposes...
""" Generates random time intervals """
import random
for x in range(30):
entry_h = random.randint(8, 10)
entry_m = random.randint(0, 59)
if entry_h == 10:
entry_m = 0
exit_h_lunch = random.randint(13, 14)
exit_m_lunch = random.randint(0, 59)
entry_h_lunch = exit_h_lunch + 1
exit_h = entry_h + 9
exit_m = entry_m + 30
if exit_m >= 60:
exit_h = exit_h + 1
exit_m = abs(60 - exit_m)
print(
f"{entry_h:02}:{entry_m:02} \t"
f"{exit_h_lunch:02}:{exit_m_lunch:02} \t"
f"{entry_h_lunch:02}:{exit_m_lunch:02} \t"
f"{exit_h:02}:{exit_m:02}")
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment