86

I understand that reads to /dev/random may block, while reading /dev/urandom is guaranteed not to block.

Where does the letter u come into this? What does it signify?

Userspace? Unblocking? Micro?

Update:

Based on the initial wording of the question, there has been some debate over the usefulness of /dev/random vs /dev/urandom. The link Myths about /dev/urandom has been posted three times below, and is summarised in this answer to the question When to use /dev/random vs /dev/urandom.

  • 13
    Unblocking, as opposed to /dev/random which is blocking. – Satō Katsura Nov 16 '16 at 5:49
  • 3
    Chapter and verse? – Tom Hale Nov 16 '16 at 5:53
  • 11
    The idea that /dev/random was somehow better than /dev/urandom is now long obsolete and for the vast majority of use cases, /dev/urandom is now preferred. – David Schwartz Nov 16 '16 at 12:26
  • @SatoKatsura Source? Tom's answer contradicts your answer. – noɥʇʎԀʎzɐɹƆ Nov 17 '16 at 0:17
  • Here is a link to site with details to backup @DavidSchwartz 's comment. 2uo.de/myths-about-urandom – Walter Nov 17 '16 at 1:33
85

Unlimited.

In Linux, comparing the kernel functions named random_read and random_read_unlimited indicates that the etymology of the letter u in urandom isunlimited.

This is confirmed by line 114:

The /dev/urandom device does not have this limit [...]

Update:

Regarding which came first for Linux, /dev/random or /dev/urandom, @Stéphane Chazelas gave the post with the original patch and @StephenKitt showed they were both introduced simultaneously.

  • 7
    Then why isn't /dev/random named /dev/lrandom? :) – Satō Katsura Nov 16 '16 at 6:13
  • 13
    Historical. At first only the limited / blocking version existed. And the analogous "non-un-limited" function is called random_read :) – Tom Hale Nov 16 '16 at 6:25
  • 10
    I did find one of the links via Wikipedia, but I'm quoting the source directly rather than quoting Wikipedia. I'd consider it analogous to finding something via google, and not quoting google... unless I have something to learn about quoting on StackExchange? – Tom Hale Nov 16 '16 at 13:04
  • 5
    @TomHale The historical argument for random v. lrandom doesn't hold all that well since both random and urandom were introduced simultaneously in the Linux kernel. – Stephen Kitt Nov 16 '16 at 13:23
  • 7
    See also the patch on usenet sent by the author of the original implementation back in 1995 – Stéphane Chazelas Nov 16 '16 at 14:38
18

It depends on which "Unix" system you are talking about.

On FreeBSD, /dev/urandom and /dev/random are the same device. The letter u is now a historical legacy that exists for backward compatibility. At startup, they block until enough entropy has been gather and then never block again. See Myths about urandom for details.

In the modern Linux world (starting with kernel 4.8), both devices pull from the same CSPRNG, so the only difference is that some people speculate at the existence of an attack. This attack is like FTL [Faster than Light] travel. Easy to speculate about, rather hard to actually design.

TLDR is just use /dev/urandom.

  • 2
    From your link, it's interesting to note that FreeBSD does the right thing: they don't have the distinction between /dev/random and /dev/urandom, both are the same device. At startup /dev/random blocks once until enough starting entropy has been gathered. Then it won't block ever again. – Tom Hale Nov 17 '16 at 4:55
-5

Uniform. Random numbers uniformly distributed between 0 and 1. A flat distribution... as opposed to a peaked distribution like Poisson, or Normal/Gaussian.

  • 3
    Have any source for that one? – GnP Nov 17 '16 at 18:18
  • 7
    This is definitely not right- /dev/random and /dev/urandom both give the same distribution, and in any real sense it's not uniformly distributed between 0 and 1. – Chris Nov 17 '16 at 19:35
  • Sorry... probably based that on another language I have used (R or something) – bbneo Dec 5 '16 at 20:11

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.