Next: Introduction, Previous: (dir), Up: (dir) [Contents][Index]
This is the seedable-rng Reference Manual, generated automatically by Declt version 3.0 "Montgomery Scott" on Mon Apr 19 17:43:41 2021 GMT+0.
• Introduction | What seedable-rng is all about | |
• Systems | The systems documentation | |
• Files | The files documentation | |
• Packages | The packages documentation | |
• Definitions | The symbols documentation | |
• Indexes | Concepts, functions, variables and data types |
Provides a convenient means of generating random numbers that are seedable with deterministic results across hardware and Common Lisp implementations.
This library is a light wrapper over cl-pcg, providing a convenient method of generating seedable random numbers. Using it is as simple as creating a generator, and calling one of the various generation functions on that generator.
Generators can be seeded with any string value, to aid in remembering the seed (rationale: words or a sequence of words are easier to remember than numbers).
If a seed string is not provided when constructing a generator, a seed is randomly generated for you. Such random seed strings are of a particular form to aid in remembering and sharing results with others. To do this, the generator randomly chooses 5 words from a curated dictionary of 7776 words that are dissimilar from each other, and appends them together delimited by hyphen characters.
In addition to constructing a generator given a seed string or having one generated automatically, we also support seeding a generator given another generator object. In this case, a seed string for the new generator is randomly generated using the seed of the supplied generator. In this way, you can have distinct nested generators giving independently deterministic results.
(ql:quickload :seedable-rng)
(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.
(get-seed generator)
Return the seed string of generator
. In case an integer is needed, one is provided as a secondary
return value.
(bool generator &optional (probability 0.5))
Randomly generate a boolean value, with probability
chance of a true result.
(int generator min max &optional (inclusive-p t))
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.
(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
.
(element generator sequence)
Randomly choose a single element from the given sequence.
(shuffle generator sequence)
Randomly shuffle the given sequence, non-destructively.
(die generator sides &key (modifier 0) (count 1))
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.
Copyright © Michael Fiano mail@mfiano.net.
Licensed under the MIT License.
Next: Files, Previous: Introduction, Up: Top [Contents][Index]
The main system appears first, followed by any subsystem dependency.
• The seedable-rng system |
Michael Fiano <mail@mfiano.net>
MIT
A seedable random number generator.
seedable-rng.asd (file)
Files are sorted by type and then listed depth-first from the systems components trees.
• Lisp files |
• The seedable-rng.asd file | ||
• The seedable-rng/package.lisp file | ||
• The seedable-rng/dictionary.lisp file | ||
• The seedable-rng/generator.lisp file | ||
• The seedable-rng/conditions.lisp file |
Next: The seedable-rng/package․lisp file, Previous: Lisp files, Up: Lisp files [Contents][Index]
/home/quickref/quicklisp/dists/quicklisp/software/seedable-rng-20210411-git/seedable-rng.asd
seedable-rng (system)
Next: The seedable-rng/dictionary․lisp file, Previous: The seedable-rng․asd file, Up: Lisp files [Contents][Index]
seedable-rng (system)
package.lisp
Next: The seedable-rng/generator․lisp file, Previous: The seedable-rng/package․lisp file, Up: Lisp files [Contents][Index]
package.lisp (file)
seedable-rng (system)
dictionary.lisp
+dictionary+ (constant)
Next: The seedable-rng/conditions․lisp file, Previous: The seedable-rng/dictionary․lisp file, Up: Lisp files [Contents][Index]
dictionary.lisp (file)
seedable-rng (system)
generator.lisp
Previous: The seedable-rng/generator․lisp file, Up: Lisp files [Contents][Index]
generator.lisp (file)
seedable-rng (system)
conditions.lisp
Next: Definitions, Previous: Files, Up: Top [Contents][Index]
Packages are listed by definition order.
• The seedable-rng package |
package.lisp (file)
common-lisp
Definitions are sorted by export status, category, package, and then by lexicographic order.
• Exported definitions | ||
• Internal definitions |
Next: Internal definitions, Previous: Definitions, Up: Definitions [Contents][Index]
• Exported functions | ||
• Exported generic functions | ||
• Exported conditions | ||
• Exported structures |
Next: Exported generic functions, Previous: Exported definitions, Up: Exported definitions [Contents][Index]
Randomly generate a boolean value, with ‘probability‘ chance of a true result.
generator.lisp (file)
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.
generator.lisp (file)
Randomly choose a single element from the given sequence.
generator.lisp (file)
Randomly generate a single-precision floating point number to be within the lower bound and upper bound denoted by ‘min‘ and ‘max‘.
generator.lisp (file)
Return the seed string of ‘generator‘. In case an integer is needed, one is provided as a secondary return value.
generator.lisp (file)
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.
generator.lisp (file)
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.
generator.lisp (file)
Randomly shuffle the given sequence, non-destructively.
generator.lisp (file)
Next: Exported conditions, Previous: Exported functions, Up: Exported definitions [Contents][Index]
conditions.lisp (file)
Next: Exported structures, Previous: Exported generic functions, Up: Exported definitions [Contents][Index]
conditions.lisp (file)
seedable-rng-error (condition)
:min
lower-bound (generic function)
:max
upper-bound (generic function)
Previous: Exported conditions, Up: Exported definitions [Contents][Index]
generator.lisp (file)
structure-object (structure)
pcg:pcg
(pcg:make-pcg)
kernel (function)
(setf kernel) (function)
golden-utils:ub64
0
internal-seed (function)
(setf internal-seed) (function)
string
""
seed (function)
(setf seed) (function)
Previous: Exported definitions, Up: Definitions [Contents][Index]
• Internal constants | ||
• Internal functions | ||
• Internal generic functions | ||
• Internal conditions |
Next: Internal functions, Previous: Internal definitions, Up: Internal definitions [Contents][Index]
dictionary.lisp (file)
Next: Internal generic functions, Previous: Internal constants, Up: Internal definitions [Contents][Index]
generator.lisp (file)
generator.lisp (file)
generator.lisp (file)
generator.lisp (file)
generator.lisp (file)
generator.lisp (file)
generator.lisp (file)
generator.lisp (file)
Next: Internal conditions, Previous: Internal functions, Up: Internal definitions [Contents][Index]
conditions.lisp (file)
conditions.lisp (file)
Previous: Internal generic functions, Up: Internal definitions [Contents][Index]
conditions.lisp (file)
seedable-rng-error (condition)
conditions.lisp (file)
error (condition)
generator (method)
:generator
generator (generic function)
Previous: Definitions, Up: Top [Contents][Index]
• Concept index | ||
• Function index | ||
• Variable index | ||
• Data type index |
Next: Function index, Previous: Indexes, Up: Indexes [Contents][Index]
Jump to: | F L S |
---|
Jump to: | F L S |
---|
Next: Variable index, Previous: Concept index, Up: Indexes [Contents][Index]
Jump to: | %
(
B D E F G I K L M S U |
---|
Jump to: | %
(
B D E F G I K L M S U |
---|
Next: Data type index, Previous: Function index, Up: Indexes [Contents][Index]
Jump to: | %
+
C I K S |
---|
Jump to: | %
+
C I K S |
---|
Previous: Variable index, Up: Indexes [Contents][Index]
Jump to: | C E G I P S |
---|
Jump to: | C E G I P S |
---|