The seedable-rng Reference Manual

This is the seedable-rng Reference Manual, version 0.1.0, generated automatically by Declt version 4.0 beta 2 "William Riker" on Thu Feb 15 07:26:00 2024 GMT+0.

Table of Contents


1 Introduction


2 Systems

The main system appears first, followed by any subsystem dependency.


2.1 seedable-rng

A seedable random number generator.

Author

Michael Fiano <>

Home Page

https://git.mfiano.net/mfiano/seedable-rng

License

MIT

Version

0.1.0

Dependencies
  • cl-pcg (system).
  • ironclad (system).
  • mfiano-utils (system).
Source

seedable-rng.asd.

Child Components

3 Files

Files are sorted by type and then listed depth-first from the systems components trees.


3.1 Lisp


3.1.1 seedable-rng/seedable-rng.asd

Source

seedable-rng.asd.

Parent Component

seedable-rng (system).

ASDF Systems

seedable-rng.


3.1.2 seedable-rng/package.lisp

Source

seedable-rng.asd.

Parent Component

seedable-rng (system).

Packages

seedable-rng.


3.1.3 seedable-rng/dictionary.lisp

Dependency

package.lisp (file).

Source

seedable-rng.asd.

Parent Component

seedable-rng (system).

Internals

+dictionary+ (constant).


3.1.4 seedable-rng/generator.lisp

Dependency

dictionary.lisp (file).

Source

seedable-rng.asd.

Parent Component

seedable-rng (system).

Public Interface
Internals

3.1.5 seedable-rng/conditions.lisp

Dependency

generator.lisp (file).

Source

seedable-rng.asd.

Parent Component

seedable-rng (system).

Public Interface
Internals

4 Packages

Packages are listed by definition order.


4.1 seedable-rng

Source

package.lisp.

Use List

common-lisp.

Public Interface
Internals

5 Definitions

Definitions are sorted by export status, category, package, and then by lexicographic order.


5.1 Public Interface


5.1.1 Ordinary functions

Function: bool (generator &optional probability)

Randomly generate a boolean value, with ‘probability‘ chance of a true result.

Package

seedable-rng.

Source

generator.lisp.

Function: die (generator sides &key modifier count)

Simulate rolling a die of ‘sides‘ sides ‘count‘ number of times, summing the results. ‘modifier‘ is an additional value to sum with the final result.

Package

seedable-rng.

Source

generator.lisp.

Function: element (generator sequence &optional empty-error-p)

Randomly choose a single element from the given sequence.

Package

seedable-rng.

Source

generator.lisp.

Function: float (generator min max)

Randomly generate a single-precision floating point number to be within the lower bound and upper bound denoted by ‘min‘ and ‘max‘.

Package

seedable-rng.

Source

generator.lisp.

Function: get-seed (generator)

Return the seed string of ‘generator‘. In case an integer is needed, one is provided as a secondary return value.

Package

seedable-rng.

Source

generator.lisp.

Function: int (generator min max &optional inclusive-p)

Randomly generate an integer (fixnum) to be within the lower bound and upper bound denoted by ‘min‘ and ‘max‘. If ‘inclusive-p‘ is non-NIL (the default), then the range is inclusive.

Package

seedable-rng.

Source

generator.lisp.

Function: int/parity (generator min max)

Randomly generate an integer (fixnum) to be within the lower bound and upper bound denoted by ‘min‘ and ‘max‘. The parity (even or odd) of ‘min‘ determines the parity of the result.

Package

seedable-rng.

Source

generator.lisp.

Function: make-generator (&optional source)

Construct a generator suitable for generating random numbers. The type of ‘source‘ determines how the generator is seeded:

null: If ‘source‘ is NIL, a seed is randomly generated. This is useful if you don’t care about deterministic results.

string: Seeded using this string. Any generator with the same string seed will result in the same sequence of random numbers.

generator: If given another generator as the source, a seed will be generated using the seed of the generator supplied. In this way, you can have distinct nested generators giving independently deterministic results.

Package

seedable-rng.

Source

generator.lisp.

Function: make-seed ()
Package

seedable-rng.

Source

generator.lisp.

Function: shuffle (generator sequence)

Randomly shuffle the given sequence, non-destructively.

Package

seedable-rng.

Source

generator.lisp.


5.1.2 Generic functions

Generic Reader: generator (condition)
Package

seedable-rng.

Methods
Reader Method: generator ((condition seedable-rng-error))
Source

conditions.lisp.

Target Slot

%generator.


5.1.3 Conditions

Condition: invalid-range
Package

seedable-rng.

Source

conditions.lisp.

Direct superclasses

seedable-rng-error.

Direct methods
Direct slots
Slot: %lower-bound
Initargs

:min

Readers

lower-bound.

Writers

This slot is read-only.

Slot: %upper-bound
Initargs

:max

Readers

upper-bound.

Writers

This slot is read-only.


5.1.4 Structures

Structure: generator
Package

seedable-rng.

Source

generator.lisp.

Direct superclasses

structure-object.

Direct slots
Slot: kernel
Type

pcg:pcg

Initform

(pcg:make-pcg)

Readers

kernel.

Writers

(setf kernel).

Slot: internal-seed
Type

mfiano-utils:ub64

Initform

0

Readers

internal-seed.

Writers

(setf internal-seed).

Slot: seed
Type

string

Initform

""

Readers

seed.

Writers

(setf seed).


5.2 Internals


5.2.1 Constants

Constant: +dictionary+
Package

seedable-rng.

Source

dictionary.lisp.


5.2.2 Ordinary functions

Function: %%make-generator (&key kernel internal-seed seed)
Package

seedable-rng.

Source

generator.lisp.

Function: %make-generator (seed)
Package

seedable-rng.

Source

generator.lisp.

Reader: internal-seed (instance)
Writer: (setf internal-seed) (instance)
Package

seedable-rng.

Source

generator.lisp.

Target Slot

internal-seed.

Reader: kernel (instance)
Writer: (setf kernel) (instance)
Package

seedable-rng.

Source

generator.lisp.

Target Slot

kernel.

Function: make-inherited-seed (generator)
Package

seedable-rng.

Source

generator.lisp.

Function: make-internal-seed (seed-string)
Package

seedable-rng.

Source

generator.lisp.

Reader: seed (instance)
Writer: (setf seed) (instance)
Package

seedable-rng.

Source

generator.lisp.

Target Slot

seed.


5.2.3 Generic functions

Generic Reader: lower-bound (condition)
Package

seedable-rng.

Methods
Reader Method: lower-bound ((condition invalid-range))
Source

conditions.lisp.

Target Slot

%lower-bound.

Generic Reader: upper-bound (condition)
Package

seedable-rng.

Methods
Reader Method: upper-bound ((condition invalid-range))
Source

conditions.lisp.

Target Slot

%upper-bound.


5.2.4 Conditions

Condition: empty-sequence
Package

seedable-rng.

Source

conditions.lisp.

Direct superclasses

seedable-rng-error.

Condition: seedable-rng-error
Package

seedable-rng.

Source

conditions.lisp.

Direct superclasses

error.

Direct subclasses
Direct methods

generator.

Direct slots
Slot: %generator
Initargs

:generator

Readers

generator.

Writers

This slot is read-only.


Appendix A Indexes


A.1 Concepts


A.2 Functions

Jump to:   %   (  
B   D   E   F   G   I   K   L   M   S   U  
Index Entry  Section

%
%%make-generator: Private ordinary functions
%make-generator: Private ordinary functions

(
(setf internal-seed): Private ordinary functions
(setf kernel): Private ordinary functions
(setf seed): Private ordinary functions

B
bool: Public ordinary functions

D
die: Public ordinary functions

E
element: Public ordinary functions

F
float: Public ordinary functions
Function, %%make-generator: Private ordinary functions
Function, %make-generator: Private ordinary functions
Function, (setf internal-seed): Private ordinary functions
Function, (setf kernel): Private ordinary functions
Function, (setf seed): Private ordinary functions
Function, bool: Public ordinary functions
Function, die: Public ordinary functions
Function, element: Public ordinary functions
Function, float: Public ordinary functions
Function, get-seed: Public ordinary functions
Function, int: Public ordinary functions
Function, int/parity: Public ordinary functions
Function, internal-seed: Private ordinary functions
Function, kernel: Private ordinary functions
Function, make-generator: Public ordinary functions
Function, make-inherited-seed: Private ordinary functions
Function, make-internal-seed: Private ordinary functions
Function, make-seed: Public ordinary functions
Function, seed: Private ordinary functions
Function, shuffle: Public ordinary functions

G
generator: Public generic functions
generator: Public generic functions
Generic Function, generator: Public generic functions
Generic Function, lower-bound: Private generic functions
Generic Function, upper-bound: Private generic functions
get-seed: Public ordinary functions

I
int: Public ordinary functions
int/parity: Public ordinary functions
internal-seed: Private ordinary functions

K
kernel: Private ordinary functions

L
lower-bound: Private generic functions
lower-bound: Private generic functions

M
make-generator: Public ordinary functions
make-inherited-seed: Private ordinary functions
make-internal-seed: Private ordinary functions
make-seed: Public ordinary functions
Method, generator: Public generic functions
Method, lower-bound: Private generic functions
Method, upper-bound: Private generic functions

S
seed: Private ordinary functions
shuffle: Public ordinary functions

U
upper-bound: Private generic functions
upper-bound: Private generic functions