3.1.2 代入を取り入れた利点






(use srfi-27)
(define (random num)
  (* (random-integer num) 1.0))

(define (random-in-range low high)
  (let ((range (- high low)))
    (+ low (random range))))
(define (estimate-integral P x1 x2 y1 y2 trials)
  (define in-circle
    (monte-carlo trials
                 (lambda ()
                   (P (random-in-range x1 x2)
                      (random-in-range y1 y2)))))
  (* in-circle (* (- x2 x1) (- y2 y1))))

;; 単位円からPIを求める
(define (estimate-pi2 trials)
  (define (P x y)
    (<= (+ (* x x) (* y y)) 1))
  (estimate-integral P -1 1 -1 1 trials))



↓のページを参考に"線形合同法 - Wikipedia"の値を決めた。

(define my-rand
  (let ((x 1))
    (define (rand-update x)
      (modulo (+ (* x 1103515245) 12345) 2147483647))
    (define (reset new-value)
      (set! x new-value) x)
    (define (generate)
        (set! x (rand-update x)) x))
    (define (dispatch m)
      (cond ((eq? m 'reset) reset)
            ((eq? m 'generate) (generate))
             (error "Unknown"))))

((my-rand 'reset ) 1000)
(my-rand 'generate)

EasterEaster2012/01/10 06:53Why does this have to be the ONLY reliable srouce? Oh well, gj!

RayaneRayane2013/08/07 05:25That's a smart answer to a tricky qutesion

GauravGaurav2013/08/09 07:27Well done <a href="http://jakregph.com">arlitce</a> that. I'll make sure to use it wisely.

EniEni2013/08/15 13:24Just the type of ingihst we need to fire up the debate. http://yulljp.com [url=http://hfmrntv.com]hfmrntv[/url] [link=http://wmmuqfw.com]wmmuqfw[/link]

NollieNollie2016/05/11 00:42(Escctroniel) This TV has one of the smallest form factors of any of the 40″ flat screen LED TVs so fit in my rather small space 38 1/2″ x 24 1/2″. It has excellent picture and sound. The only reason that I rate it 4* instead of 5* is because it has rather limited inputs and outputs on the back panel (2 HDMI, 1 component video which can alternate as a composite video in) there is no VGA in for a computer, no S-video in, no audio out). It think it is an excellent value. Samsung obviously went with less inputs and outputs and putting their priority in the picture and sound quality of this TV.