random   scheme


Defined in:  https://github.com/digego/extempore/tree/v0.8.9/runtime/scheme.xtm

Implementation

(define (random . args)
  (cond ((< (length args) 1)
         (random-real))
        ((list? (car args))
         (list-ref (car args) (random (length (car args)))))
        ((pair? (car args))
         (apply weighted-selection args))
        (else (let ((lower (if (> (length args) 1) (real->integer (car args)) 0))
                    (upper (if (> (length args) 1) (cadr args) (car args))))
                (+ lower (random-int (- upper lower)))))))


Back to Index

Similar Entries

  • PARAM_RANDOM    scheme
  • PARAM_RANDOM    scheme
  • generate_And_Wrap_Pseudorandom_DNA_Sequence    xtlang
  • generate_random_vao    xtlang
  • get_LCG_Pseudorandom_Number    xtlang
  • pc:random    scheme
  • random    xtlang
  • random-next    scheme
  • xt_pcg32_random    xtlang
  • xt_pcg32_random_r    xtlang
  • xt_pcg32_srandom    xtlang
  • xt_pcg32_srandom_r    xtlang