Previous: random utils vectors, Up: random utils [Index]
The auxiliary library (vicare crypto randomisations strings)
exports bindings specialised to handle strings and randomness sources;
it is based on both (vicare crypto randomisations)
and
(vicare containers strings)
. Arguments to the following
functions follow the same conventions established for (vicare
containers strings)
and (vicare containers strings low)
.
Interface conventions
Given the closure integer-maker returning a random integer, build and return a new string of number-of-chars random characters.
As a usage example, the following program will generate random passwords with characters in the range of graphics ASCII codes (warning: for real world applications, use a true random source):
(import (rnrs) (vicare randomisations) (vicare randomisations strings) (vicare char-sets)) (random-string-unfold-chars (lambda () (do ((ch (random-integer 127) (random-integer 127))) ((char-set-contains? char-set:ascii/graphic (integer->char ch)) ch))) 10)
Build a new string copying the selected substring, then shuffle it using randomness from the given source. Return the new string.
Shuffle the selected substring using randomness from the given source. Return the shuffled string itself.
Return a closure that, when evaluated with no arguments, returns a randomly selected item from the selected substring, using randomness from source.
Return a closure that, when evaluated with no arguments, returns a string of len items randomly selected from the selected substring of str, using randomness from source.
Previous: random utils vectors, Up: random utils [Index]