Create a gist now

Instantly share code, notes, and snippets.

#! /bin/sh
#| Hey Emacs, this is -*-scheme-*- code!
exec mzscheme -l errortrace --require "$0" --main -- ${1+"$@"}
#lang scheme
(define (trial)
(let loop ([number-of-numbers 0]
[sum 0])
(if (<= 1 sum)
(loop (add1 number-of-numbers)
(+ (random) sum)))))
(define (main)
(let ([outcomes (for/list ([t (in-range 0 1000000)])
(/ (apply + outcomes)
(length outcomes)))))
(provide main)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment