You are looking at historical revision 32807 of this page. It may differ significantly from its current revision.

Outdated egg!

This is an egg for CHICKEN 3, the unsupported old release. You're almost certainly looking for the CHICKEN 4 version of this egg, if it exists.

If it does not exist, there may be equivalent functionality provided by another egg; have a look at the egg index. Otherwise, please consider porting this egg to the current version of CHICKEN.

Documentation for the gsl-srfi-27 egg

Introduction

The gsl-srfi-27 egg provides an implementation of SRFI-27 which uses the GSL behind the scenes to generate pseudo-random numbers.

Examples

(use syntax-case gsl-srfi-27)

(import gsl-srfi-27)

(random-real) ; => some random real number

(random-source-randomize! default-random-source)

(random-integer 100) ; => some integer between 0 and 99 (inclusive)

You can also use some of the simulation-quality generators from the GSL:

(use syntax-case gsl-srfi-27)

(import gsl-srfi-27)

(let* ((luxury-source (make-random-source *ranlxd2*))  ; Ahhh---what a luxurious generator
       (luxury-real (random-source-make-reals luxury-source)))
  (random-source-randomize! luxury-source) ; Don't forget this, or you won't experience true luxury
  (luxury-real)) ;; A *very* random number.

Authors

Written by Will M. Farr.

License

Released under the GPL.

Requirements

Requires the eggs syntax-case and easyffi.

Documentation

In addition to the routines from SRFI-27, after issuing (import gsl-srfi-27) the following will be available in the namespace:

[rng-type] *mt19937*
[rng-type] *ranlxd1*
[rng-type] *ranlxd2*
[rng-type] *cmrg*
[rng-type] *mrg*
[rng-type] *taus*
[rng-type] *taus2*
[rng-type] *gfsr4*

A subset of the GSL simulation-quality generator types, suitable to pass to (make-random-source TYPE). Don't accept anything less than a simulation-quality generator!

[procedure] (rng-type? OBJ)

#f unless OBJ is one of the above generator types.

Standards Violation

The gsl-srfi-27 egg does not completely conform to the SRFI-27 standard: (random-source-make-reals SOURCE [UNIT]) throws an error if the UNIT parameter is passed instead of generating a random source with the given quantization.

Version History

Version 1.0
Initial release.