Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
import datetime
import random
from datetime import timedelta
from random import randint
def random_date(start, end):
return start + timedelta(
seconds=randint(0, int((end - start).total_seconds())))
datetimes = [ random_date(datetime.datetime.now(), datetime.datetime.now() + datetime.timedelta(days=1)) for x in range(1000)]
int_numbers = [ randint(0,1000) for x in range(1000)]
%timeit sorted(int_numbers)
%timeit sorted(datetimes)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.