Hello Everybody,

I am on a Ubuntu system and I just came across /dev/random

I tried searching for examples of how to use this utility (or file/ or command) to generate a random number but I cannot find anything.

Quick note I am trying to generate a random number on the command prompt not in a C program. Is this possible ?

If you're just trying to display the result, something like this would work:

$ cat /dev/random | od -tl -w4

Remember that /dev/random is just a file. You can process it like any other file.

I ran the command as you said and I am getting an error

~$ cat /dev/random | od -tl -w4
od: invalid character `l' in type string `l'
^C
~$ ^C

Run man od for a list of supported formats on your system.

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.