zsh-workers
 help / color / mirror / code / Atom feed
c9dc76231aa623f2825470e1b79fed99025297b3 blob 1540 bytes (raw)

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
 
COMMENT(!MOD!zsh/random
Some High-quality randomness parameters and functions.
!MOD!)
The tt(zsh/random) module gets random data from the kernel random pool. If no
kernel random pool can be found, the module will not load.

subsect(Parameters)

startitem()
vindex(SRANDOM)
item(tt(SRANDOM)) (
A random positive 32-bit integer between 0 and 4,294,967,295.  This parameter
is read-only.
)
enditem()

subsect(Math Functions)

startitem()
item(tt(zrand_float+LPAR()RPAR())) (
Returns a random floating point number between 0 and 1.
)
enditem()

startitem()
item(tt(zrand_int)+LPAR()tt(upper), tt(lower), tt(inclusive)RPAR()) (
Returns a random integer between tt(lower) and tt(upper). All parameters are
optional.  If none are specified it is equivilent to
tt(SRANDOM).

tt(upper) is the upper bound on the resultant number and defaults to
4,294,967,295.

tt(lower) is the lower bound and defaults to 0.

tt(inclusive) is a flag to determine whether the result can ever equal
tt(upper).  By default it can not. If this argument is set to a non-zero value
then it can.

This is to facilitate a construct like tt($a[zrand_int($#a)+1]) rather
than tt($a[zrand_int+LPAR()$#a-1+RPAR()+1]).
tt(zrand_int+LPAR()16RPAR()) has 16
possible return values 0-15, in order to use it as an array index which goes
from 1-16 you need to add one.  Since it can return zero, you don't want it
to return 16.

Most statistics algorithms seem to also expect 0 to tt(upper)-1, so this was
deemed the most commonly desired case and chosen as the default.
)
enditem()

debug log:

solving c9dc76231 ...
found c9dc76231 in https://inbox.vuxu.org/zsh-workers/fa3e4452-16d3-43d7-8b62-b112069c1357@zentaur.org/

applying [1/1] https://inbox.vuxu.org/zsh-workers/fa3e4452-16d3-43d7-8b62-b112069c1357@zentaur.org/
diff --git a/Doc/Zsh/mod_random.yo b/Doc/Zsh/mod_random.yo
new file mode 100644
index 000000000..c9dc76231

Checking patch Doc/Zsh/mod_random.yo...
1:57: new blank line at EOF.
+
Applied patch Doc/Zsh/mod_random.yo cleanly.
warning: 1 line adds whitespace errors.

index at:
100644 c9dc76231aa623f2825470e1b79fed99025297b3	Doc/Zsh/mod_random.yo

Code repositories for project(s) associated with this public inbox

	https://git.vuxu.org/mirror/zsh/

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).