random number generator on porteus

Non release banter
Post Reply
User avatar
francois
Contributor
Contributor
Posts: 5080
Joined: 28 Dec 2010, 14:25
Distribution: kde xfce porteus manjaro kubun
Location: Enfin l'été, le changement climatique attendu: le soleil.

random number generator on porteus

Post#1 by francois » 03 Jan 2014, 14:41

Is there a random number generator on porteus? If yes, how come there is nothing in /dev/random or /dev/urandom?

I need to know that in relation to a program that I tried to build: qpdf. During buildup it said that /dev/random or /dev/urandom were not available.

Thanks :)
Last edited by francois on 04 Jan 2014, 03:03, edited 1 time in total.
Voltaire: Le mieux est l'ennemi du bien.

User avatar
francois
Contributor
Contributor
Posts: 5080
Joined: 28 Dec 2010, 14:25
Distribution: kde xfce porteus manjaro kubun
Location: Enfin l'été, le changement climatique attendu: le soleil.

Re: random number generator on porteus

Post#2 by francois » 04 Jan 2014, 03:01

There is:
http://www.cyberciti.biz/faq/bash-shell ... m-numbers/
Using /dev/urandom or /dev/random

The character special files /dev/random and /dev/urandom provide an interface to the kernel's random number generator. You can use /dev/urandom as follows:

Code: Select all

$ od -vAn -N4 -tu4 < /dev/urandom
Sample outputs:

Code: Select all

2494028411
You can use /dev/random as follows:

Code: Select all

$ od -An -N2 -i /dev/random

Sample outputs:
[code]62362
[/code]
So I got my answer.
Voltaire: Le mieux est l'ennemi du bien.

User avatar
brokenman
Site Admin
Site Admin
Posts: 5574
Joined: 27 Dec 2010, 03:50
Distribution: Porteus v3.2rcX all desktops
Location: Brazil
Contact:

Re: random number generator on porteus

Post#3 by brokenman » 21 Jan 2014, 13:55

You can use the built in bash variable $RANDOM

Code: Select all

echo $RANDOM
let x=( $RANDOM *42) && echo $x
How do i become super user?
Wear your underpants on the outside and put on a cape.

Post Reply