--- name: rand status: documented runtime: pp source: src/runtime/pp/helpers.rs --- ```{index} single: rand; Perl built-in (pp runtime) ``` # rand ## Synopsis ```perl my $r = rand; # 0 <= $r < 1 my $r = rand(10); # 0 <= $r < 10 my $r = rand($n); ``` ## Description Returns a pseudo-random floating-point number. Returns a pseudo-random floating-point number greater than or equal to 0 and less than EXPR (or 1 if omitted). If EXPR evaluates to zero, 1.0 is used instead. Uses the interpreter's `StdRng` state, which can be seeded via `srand`. Not suitable for cryptographic purposes. ## See also srand, int