Changeset 40052 in project


Ignore:
Timestamp:
04/23/21 18:43:54 (3 weeks ago)
Author:
Kon Lovett
Message:

simplify random normals test

File:
1 edited

Legend:

Unmodified
Added
Removed
  • release/5/slib-charplot/trunk/tests/slib-charplot-test.scm

    r40050 r40052  
    148148                  (+ mu (* sigma scale v1)) ) ) ) ) ) ) ) ) )
    149149
    150 ;SLIB wrapper
    151 (define random:normal
    152   (let (
    153     (random-normal
    154       (let ()
    155         (import (only (chicken random) pseudo-random-real))
    156         (*make-random-normals 0 1 pseudo-random-real))) )
    157     random-normal ) )
     150(define random-normal
     151  (let ()
     152    (import (only (chicken random) pseudo-random-real))
     153    (*make-random-normals 0 1 pseudo-random-real)))
    158154
    159155(define (make-normals n bias)
    160   (do ((idx n (+ -1 idx))
    161        (lst '() (cons (* bias (random:normal)) lst)))
    162       ((negative? idx) lst)))
     156  (do ((n n (sub1 n))
     157       (ls '() (cons (* bias (random-normal)) ls)))
     158      ((<= n 0) ls)) )
    163159
    164160(print)
Note: See TracChangeset for help on using the changeset viewer.