rethinkpriorities / squigglepy

Squiggle programming language for intuitive probabilistic estimation features in Python
MIT License
65 stars 8 forks source link

make it so random.choice is not faster for sampling from a list than sq.discrete #15

Open peterhurford opened 1 year ago

agucova commented 1 year ago

This is quite hard to beat:

image

Where _randbelow is defined as:

image

From here.

agucova commented 1 year ago

Oh, I see what you mean:

image

peterhurford commented 1 year ago

Ok I agree I don't need it to be literally as fast as random.choice as that seems unrealistic but I do think it should be possible to get it much closer. Could even consider using random.choice directly if we got the seed working right.