<div dir="ltr">So maybe I should just have a smaller size bound? (the 10 in the 'gen-exp' function)<div><br></div><div style>Really, perhaps, what I should do is not have a smaller size bound but instead just make the number of tests I do (32 in the currently pushed thing) depend on how long I've been testing.</div>
<div><br></div><div>Robby</div></div><div class="gmail_extra"><br><br><div class="gmail_quote">On Fri, Jan 4, 2013 at 4:42 PM, Neil Toronto <span dir="ltr"><<a href="mailto:neil.toronto@gmail.com" target="_blank">neil.toronto@gmail.com</a>></span> wrote:<br>
<blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><div class="im">On 01/04/2013 03:06 PM, Robby Findler wrote:<br>
<blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">
Very cool! I've run into this problem a few times.<br>
<br>
And here's an example where it happens right now ....<br>
<br>
<a href="http://drdr.racket-lang.org/26021/collects/tests/future/random-future.rkt" target="_blank">http://drdr.racket-lang.org/<u></u>26021/collects/tests/future/<u></u>random-future.rkt</a><br>
</blockquote>
<br></div>
Yeah, your problem is very similar. The difference is that in my case, I had averages and variance that changed with the number of tests I wanted to run. If I understand correctly how Redex generates terms, you're getting independent, random programs from a fixed distribution. It just happens that the distribution of program sizes has a *lot* of variance - it has a "fat tail".<br>
<br>
I'd try simple rejection sampling first:<br>
<br>
(define gen-exp (let ([f (generate-term fut exp)])<br>
(λ ()<br>
(define t (f 10))<br>
(cond [(> (length (flatten t)) n) (gen-exp)]<br>
[else t]))))<br>
<br>
When I had n = 100 and a `printf' that printed expression sizes, I got output like this from running (gen-exp):<br>
<br>
375<br>
5092<br>
45318<br>
2331<br>
2184<br>
20<br>
<br>
I didn't see more than 13 rejections in about 30 samples (most were around 3-6), so the rejection loop seems fast enough.<br>
<br>
If you actually want unbounded program sizes, there are other rejection methods that'll thin the tail of your distribution without zeroing it out. But you probably don't want that.<span class="HOEnZb"><font color="#888888"><br>
<br>
Neil ⊥<br>
<br>
</font></span></blockquote></div><br></div>