<div dir="ltr"><div class="gmail_quote"><div dir="ltr">On Wed, May 10, 2017 at 8:27 PM Alex S. <<a href="mailto:alex0player@gmail.com">alex0player@gmail.com</a>> wrote:<br></div><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">Remember that you can generate a random element of the list using built-in generators. I think this would be the most natural approach.<br><br></blockquote><div><br></div><div>gen_alex() -></div><div>    ?LET(L, non_empty(list(nat())),</div><div>      {L, elements(L)}).</div><div><br></div><div>Indeed, this is also a way to do it. Generate a non-empty list of elements, then pick a random element in the list. This is quite a deal faster since you don't have to run appending all the time. 270.000 test cases in 10 seconds.</div><div> </div></div></div>