Hacker Newsnew | past | comments | ask | show | jobs | submitlogin

There's one pretty common exception that's "closed closed".

    random.randint(a, b)
    Return a random integer N such that a <= N <= b. Alias for randrange(a, b+1).
https://docs.python.org/3/library/random.html#random.randint

But in reality nowadays you almost always want to use the newer, simpler and more secure "secrets" module.



TIL about the "secrets" module. I have typically used os.urandom() when I needed secure random.




Consider applying for YC's Winter 2026 batch! Applications are open till Nov 10

Guidelines | FAQ | Lists | API | Security | Legal | Apply to YC | Contact

Search: