Open default-kramer opened 5 years ago
I just ran into this problem, the issue is a bug in the pick function where the recursive call fails to pass the cdr of the generator list, so ultimately always picks the first one. It also explains why passing 0 as the first frequency causes an infinite loop.
[Edit - I'll submit a PR]
I might be misunderstanding what
choose-with-frequencies
does. I was trying to make a generator that produces integers or symbols at random. I did this:But I get 100 integers, followed by "OK, passed 100 tests."
Also, if I reduce the frequency of the first option to 0, it runs forever.
Is this expected? Is it possible to make a generator that produces different kinds of values randomly?