Ask Your Question

Revision history [back]

Sample a large random number

I am trying to randomly (uniformly) sample an integer between 0, and say 2^1000 (or ideally an arbitrary large number). Attempting to do by calling random sample yields an overflow error:

sample(range(2^130), 7)

OverflowError: Python int too large to convert to C ssize_t Is it possible to do this?