97

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
  • 15
    Unblocking, as opposed to /dev/random which is blocking. Commented Nov 16, 2016 at 5:49
  • 3
    Chapter and verse?
    – Tom Hale
    Commented Nov 16, 2016 at 5:53
  • 12
    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. Commented Nov 16, 2016 at 12:26
  • @SatoKatsura Source? Tom's answer contradicts your answer. Commented Nov 17, 2016 at 0:17
  • Here is a link to site with details to backup @DavidSchwartz 's comment. 2uo.de/myths-about-urandom
    – Walter
    Commented Nov 17, 2016 at 1:33

3 Answers 3

100

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.

11
  • 8
    Then why isn't /dev/random named /dev/lrandom? :) Commented Nov 16, 2016 at 6:13
  • 14
    Historical. At first only the limited / blocking version existed. And the analogous "non-un-limited" function is called random_read :)
    – Tom Hale
    Commented Nov 16, 2016 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
    Commented Nov 16, 2016 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. Commented Nov 16, 2016 at 13:23
  • 7
    See also the patch on usenet sent by the author of the original implementation back in 1995 Commented Nov 16, 2016 at 14:38
21

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.

1
  • 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
    Commented Nov 17, 2016 at 4:55
-6

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

3
  • 3
    Have any source for that one?
    – GnP
    Commented Nov 17, 2016 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
    Commented Nov 17, 2016 at 19:35
  • Sorry... probably based that on another language I have used (R or something)
    – bbneo
    Commented Dec 5, 2016 at 20:11

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .