2017-08-27

(sph random-data)

generate random data. strings, booleans, lists, bytevectors, characters, ...

uses (random-state-from-platform) for a random state that differs each time guile starts

part of sph-lib

import name

(sph random-data)

exports

primitive-random

procedure

signature

a [b] ->

random

procedure

signature

max-value [min-value state] ->

integer [integer random-state] -> integer

description

create a number between min-value and max-value.

if the result number will be an integer or real number depends on the type of the given max-value

random-ascii-string

procedure

signature

len ->

integer -> string

description

results in a string of randomly chosen ascii characters excluding control characters

random-boolean

procedure

signature

->

-> boolean

random-bytevector

procedure

signature

size ->

integer -> bytevector

random-list

procedure

signature

list-length [max-value min-value state] ->

integer integer integer random-state -> (integer ...)

description

create a list of numbers using "random"

random-string

procedure

signature

[len char-set state] ->

[integer string/vector] -> string

description

the default set of characters includes all the code points to which unicode has assigned a character or other meaning

random-weighted-boolean

procedure

signature

percentage ->

integer -> boolean

description

percentage is proportional to the amount of false values

sph-random-data-description

variable

tags: programming guile documentation library scheme sph-lib random-data sph-random-data