Random

  • random — Generate a random value.
  • random binary — Generate random bytes.
  • random bool — Generate a random boolean value.
  • random chars — Generate random chars uniformly distributed over ASCII letters and numbers: a-z, A-Z and 0-9.
  • random float — Generate a random float within a range [min..max].
  • random int — Generate a random integer [min..max].
  • random pass — Generate a cryptologically secure password.
  • random uuid — Generate a random uuid string of the specified version.

Ported from nushell/nushell.github.io. Copyright (c) 2021 Nushell Project. MIT License.

Tips

Intro

random int draws from a range.

random int 1..3

random bool is true or false.

random bool | into string

Basic

A random integer can be shown as text.

random int 1..5 | math abs | into string

random uuid is text you can measure.

random uuid | str length | math abs

Intermediate

Three steps from a random integer.

random int 1..9 | into string | str length | math abs

Draw a bool for each list item.

[1 2 3] | each {|n| random bool} | length

Advanced

Four steps from a random integer to a count.

random int 1..9 | into string | str length | into string | str length