Home > OS >  Generate random vector with iid entries uniform in {x 1, x 2, ..., 2x log p} in Python
Generate random vector with iid entries uniform in {x 1, x 2, ..., 2x log p} in Python

Time:03-08

Dears,

I am trying to code The extented Lagarias Odlyzko (ELO) algorithm using Python, I managed to code the steps 2,3,4,5.

Could you advice how to write Python code for step 1: generate Z = random vector with independent and identically distributed random variables (iid) entries uniform in {x 1, x 2, ..., 2x log p}^p?

Where, p is the number of features, for example: 20

Here is: ELO Algorithm

Thank you.

CodePudding user response:

If the problem is just how to generate a uniform random number with a given range, please look at Daniel Lemire's paper, "Fast Random Integer Generation on an Interval".

For a Python library function, consider random.randrange() or random.randint().


  • Related