RANDOM(1)

🎲 RANDOM(1) β€” the fish-shell random page, but make it cute 🎲

okay bestie, this is a page from the fish-shell manual set, and it's literally the easiest way to get a random number in your terminal. no cap. let's get into it πŸ’…

✨ NAME ✨

random β€” generate random number. that's it. that's the whole vibe. πŸŽ€

πŸ¦‹ SYNOPSIS πŸ¦‹

random
random SEED
random START END
random START STEP END
random choice [ITEMS ...]

five whole forms, pick your fighter πŸ’–

🌸 DESCRIPTION 🌸

random generates a pseudo-random integer from a uniform distribution. the range (inclusive!) depends on the arguments you feed it. so let's talk arguments, because this is where it gets iconic:

  • no arguments at all β€” you get a range of 0 to 32767 (inclusive). just a little guy. a number. slay.
  • one argument β€” plot twist 🫢 this doesn't print anything!! the internal engine gets seeded with that argument for future invocations of random, and no output is produced. so it's a setup move, not a payoff move. iykyk.
  • two arguments β€” a range from START to END, and yes, both START and END are included. inclusive range math, we love to see it.
  • three arguments β€” a range from START to END with a spacing of STEP between possible outputs. so like, every other number, or every third number, whatever you set. very demure, very controlled. ✨
  • random choice β€” picks one random item from the arguments that follow it. this is the main character of the whole command honestly πŸ‘‘

and the -h or --help option displays help about using this command. classic. helpful. we stan. πŸ’œ

⚠️ okay important caveats, listen up: seeding the engine will NOT give the same result across different systems. so don't go thinking you can reproduce your little random moment on someone else's machine, because you cannot. 😭
πŸ’€ and please, for the love of everything: you should not consider random cryptographically secure, or even statistically accurate. it is a fun little number generator, not a security tool. do not build your password vault on this. i'm begging. πŸ™ˆ

πŸ”₯ EXAMPLE πŸ”₯

okay so the examples are genuinely so good, let's go one by one:

1. this code counts down from a random even number between 10 and 20 down to 1:

for i in (seq (random 10 2 20) -1 1)
    echo $i
end

look at that nested seq, look at the step of -1, it's giving reverse countdown realness ⭐

2. and this opens a random picture from any of the subdirectories:

open (random choice **.jpg)

random choice plus a glob = chaos, but make it aesthetic πŸ¦‹

3. or, to only get even numbers from 2 to 20:

random 2 2 20

start 2, step 2, end 20. evens only. clean. πŸ’…

4. or odd numbers from 1 to 3:

random 1 2 3 # or 1 2 4

note the little comment there β€” 1 2 4 works too, and the manpage ships it exactly like that, so we're keeping it exactly like that 🫢


fish-shell developers πŸ’–


and that's the whole page, bestie! 🌈 this one's version 4.9, dated Sep 08, 2026, brought to you by the fish-shell crew at the bottom of the page β€” mwah, thanks for the manual, go forth and generate some mid-quality randomness πŸ”₯πŸŽ€

πŸ“¦ where this page comes from
  • arch rolling: fish 4.9.3-1 Β· GPL-2.0-only AND BSD-3-Clause AND ISC AND MIT AND PSF-2.0
  • πŸ’– girlified by deepseek-ai/DeepSeek-V4.1-Flash-1017 on : a language model's rewrite of the original, under its terms