vendredi 22 avril 2016

Easiest way to generate random int64 in numpy? Why do random methods produces floats and int32?

I want to make random array of int64 uniformly distributed in some range that is not within int32 limits.

There is randint and random_integers but they work with int32; supplying big upper limit produces high is out of bounds for int32.

How do I generate random int64 array with specified range?

Possible solutions:

  • Use floats generator. Won't it have poor resolution in this case?
  • Generate random bytes, interpret them as int64 array and then normalize via lower + x % (upper - lower). But do int32 generation has same normalization? Doesn't it affect uniformity?

Didn't I miss some more concise and convenient ways?




Aucun commentaire:

Enregistrer un commentaire