Reading from /dev/random

Let’s learn how to read from the /dev/random system device.

We'll cover the following

In this lesson, we’ll learn how to read from the /dev/random system device. The purpose of the /dev/random system device is to generate random data, which we might use for testing our programs or, in this case, as the seed for a random number generator. Getting data from /dev/random can be a little bit tricky, and this is the main reason for specifically discussing it here.

Coding example

The code of devRandom.go is the following:

Get hands-on with 1400+ tech skills courses.