.\" Man page generated from reStructuredText. . . .nr rst2man-indent-level 0 . .de1 rstReportMargin \\$1 \\n[an-margin] level \\n[rst2man-indent-level] level margin: \\n[rst2man-indent\\n[rst2man-indent-level]] - \\n[rst2man-indent0] \\n[rst2man-indent1] \\n[rst2man-indent2] .. .de1 INDENT .\" .rstReportMargin pre: . RS \\$1 . nr rst2man-indent\\n[rst2man-indent-level] \\n[an-margin] . nr rst2man-indent-level +1 .\" .rstReportMargin post: .. .de UNINDENT . RE .\" indent \\n[an-margin] .\" old: \\n[rst2man-indent\\n[rst2man-indent-level]] .nr rst2man-indent-level -1 .\" new: \\n[rst2man-indent\\n[rst2man-indent-level]] .in \\n[rst2man-indent\\n[rst2man-indent-level]]u .. .TH "RANDOM" "1" "Nov 13, 2025" "4.2" "fish-shell" .SH NAME random \- generate random number .SH SYNOPSIS .nf \fBrandom\fP \fBrandom\fP \fISEED\fP \fBrandom\fP \fISTART\fP \fIEND\fP \fBrandom\fP \fISTART\fP \fISTEP\fP \fIEND\fP \fBrandom\fP \fBchoice\fP [\fIITEMS\fP \&...] .fi .sp .SH DESCRIPTION .sp \fBrandom\fP generates a pseudo\-random integer from a uniform distribution. The range (inclusive) depends on the arguments. .sp No arguments indicate a range of 0 to 32767 (inclusive). .sp If one argument is specified, the internal engine will be seeded with the argument for future invocations of \fBrandom\fP and no output will be produced. .sp Two arguments indicate a range from \fISTART\fP to \fIEND\fP (both \fISTART\fP and \fIEND\fP included). .sp Three arguments indicate a range from \fISTART\fP to \fIEND\fP with a spacing of \fISTEP\fP between possible outputs. .sp \fBrandom choice\fP will select one random item from the succeeding arguments. .sp The \fB\-h\fP or \fB\-\-help\fP option displays help about using this command. .sp Note that seeding the engine will NOT give the same result across different systems. .sp You should not consider \fBrandom\fP cryptographically secure, or even statistically accurate. .SH EXAMPLE .sp The following code will count down from a random even number between 10 and 20 to 1: .INDENT 0.0 .INDENT 3.5 .sp .EX for i in (seq (random 10 2 20) \-1 1) echo $i end .EE .UNINDENT .UNINDENT .sp And this will open a random picture from any of the subdirectories: .INDENT 0.0 .INDENT 3.5 .sp .EX open (random choice **.jpg) .EE .UNINDENT .UNINDENT .sp Or, to only get even numbers from 2 to 20: .INDENT 0.0 .INDENT 3.5 .sp .EX random 2 2 20 .EE .UNINDENT .UNINDENT .sp Or odd numbers from 1 to 3: .INDENT 0.0 .INDENT 3.5 .sp .EX random 1 2 3 # or 1 2 4 .EE .UNINDENT .UNINDENT .SH COPYRIGHT fish-shell developers .\" Generated by docutils manpage writer. .