UNIX random devices and utilities

learn more… | top users | synonyms

6
votes
3answers
284 views

Print random lines respecting the order of the source file

I have a large text file (~500K lines) with short sentences (couple of words long). Additionally, there is some XML markup in most of the lines. Finally, the text file has been sorted before the ...
2
votes
3answers
46 views

Duplicate a file with random probability

I have a directly full of images and I am trying to put together a script/command that will randomly copy (with some probability) the image to a location with a random name at that destination ...
3
votes
1answer
59 views

Shuffle two parallel text files

I have two sentence-aligned parallel corpora (text files) with about 50 mil words. (from the Europarl corpus -> parallel translation of legal documents). I'd now like to shuffle the lines of the two ...
3
votes
2answers
72 views

Is it bad to have a low entropy in /dev/random?

I wonder whether for the average Linux user it is considered as bad -from a point of view of security or any other relevant viewpoints- to have no or almost no entropy left in /dev/random. Edit: I ...
1
vote
2answers
31 views

Randomly copy certain amount of certain file type from one directory into another

Sometimes I have a folder full of jpg's and I need to randomly choose 8 or so of them. How could I automate this so my account randomly chooses 8 jpg's from the folder and copies them to another ...
2
votes
2answers
148 views

How to generate a random string in a profile alias?

I have an alias in my server's /etc/profile which generates a random directory on command, like this: alias rdir="mkdir -p ./`cat /dev/random | tr -cd 'a-z0-9' | head -c 8`/" But it turns out this ...
1
vote
3answers
66 views

Random sampling and outputting the largest value

I have a fairly large data set ~500 million rows. The data set looks like below. Col 1 is float number, col 2 is mac id(device id) 1616.93,ac:22:0b:a6:22:c3 2872.32,c0:bd:d1:36:bb:49 ...
0
votes
3answers
69 views

How to achieve “continuos randomness”?

With RANDOM%xone gets a set of discrete results. How can I achieve following scenario?: Inside a for loop, I'd like to let a bash script execute command A in 33.33% of all loops and else execute ...
6
votes
5answers
628 views

Sources of Entropy for Linux

Let's say I want a gigabyte or so of random data from /dev/random, suitable for a one-time pad (so /dev/urandom is out.) How do I seed my /dev/random with enough entropy to do this? I am looking for ...
2
votes
2answers
95 views

How can I shuffle pages from a pdf file in a random order?

I would like to shuffle the pages of a pdf document in a random order. How can this be done?
3
votes
2answers
44 views

Decreasing or emptying the entropy pool?

I work with virtual machines a lot, and they seem to generally be low on entropy (no mouse or other entropy-generating inputs). A bug with my software has surfaced, and I think it's due to running out ...
0
votes
0answers
22 views

adapt this yates-fisher code for a random generator

I am trying to make my version of a random number generator that doesn't leave bash scripting language. Starting with a yates-fisher shuffle, i am trying to use this as the starting point...and go ...
3
votes
1answer
732 views

Debian Jessie - Random freezes

I have a fresh installation of Debian Jessie, with Cinnamon and Gnome. I run it on a decent computer with the following specs: Athlon II x3, 6GB DDR2, 2GB SWAP (swapiness minimum), 600GB SATA HDD ...
5
votes
1answer
392 views

How to copy a file several times into randomly choosen paths within the filesystem?

I have a filesystem and a special file foo. I would like the script to choose several times (5,10 or 100) random paths to folders within this filesystem and to copy the file foo into each of them. ...
4
votes
4answers
461 views

How to fill a file with a stream from /dev/urandom with a specified number of lines ?

I am trying to fill a file with a sequence of random 0 and 1s with a user-defined number of lines and number of characters per line. the first step is to get a random stream of 0 and 1s: cat ...
2
votes
3answers
112 views

gpg key generation on Tails live cd - why so quick?

I just used gpg2 --gen-key to generate a 2048 bit RSA key pair on an OS running on a live cd (Tails). This happened much faster than I expected. When I have done this before on a regular machine it ...
3
votes
1answer
41 views

How random is the pseudo random number generators on live boot disks? Is there a way to seed it?

I know that random number generators on computers are only pseudo-random, but are the PRNGs on Live Boot USB or DVDs even less random? Is there a way to seed them after booting? Specifically curious ...
3
votes
2answers
141 views

How to quickly generate (insecure) GPG keys?

I'd like to automate generating at least two GPG keys for testing and demonstration purposes in a virtual machine. Because of this context I want to make sure the key generation is fast, ideally not ...
2
votes
1answer
407 views

Changing the hostname on a Linux Mint desktop to a random value at boot time

When changing the hostname to a random set of alphanumeric characters on a machine running Linux Mint(17.1 Rebecca, Cinnamon 64-bit) I encounter some problems. The following script changes the ...
0
votes
1answer
81 views

php shell_exec() + /dev/hwrng: no output

I have this PHP script: <?php $od = shell_exec('od /dev/hwrng --address-radix=n --read-bytes=4 --format=u4'); ?> <html> <head> <title>hwrng</title> </head> ...
1
vote
2answers
55 views

Creating a device similar to /dev/random from a script

I am writing a program for which I will create a script to generate test data in a specific format. How can I create a /dev/myprogram device that would work similar to /dev/random (preferably in ...
2
votes
1answer
180 views

Low(?) entropy available on Arch Linux?

I just had some problems to get Pidgin with OTR running, because Pidgin hung on every attempt to generate my private key. This rather old blog post pointed me into the right direction (or rather ...
2
votes
1answer
143 views

What entropy sources are used by the Linux kernel?

man 4 random has a very vague description of Linux kernel entropy sources: The random number generator gathers environmental noise from device drivers and other sources into an entropy ...
2
votes
1answer
361 views

rngd - multiple instances from init script

On Ubuntu >=12.04, what is the most correct/prettiest way to get rngd to run in multiple instances using an init script? The current one only accepts one random source, so multiple instances are ...
1
vote
2answers
112 views

Randomize arguments ( that hold color codes) from an array

I have the array (shown below) with arguments that hold color codes. The intended purpose of my script is to randomize those arguments when the user inputs "scriptname randoms Text" so that every time ...
4
votes
2answers
437 views

random permutation of lines of text

If I have a file with following content: 0001 0002 0003 0004 0132 0137 0138 0141 How can I get a random permutation of them in bash?
2
votes
1answer
67 views

What is the correct available entropy on UNIX systems?

I have three questions related to entropy on UNIX systems: I check entropy on Linux using: cat /proc/sys/kernel/random/entropy_avail. Is this the standard place with information about available ...
0
votes
2answers
105 views

check two partitions by selecting random files and running sha1 hashes on two files of each partition

A previous answer to a post mentions to run sha1 hashes on an images of a dd drive clone image. Another answer to that post suggests mounting the dd image an then compare if the sha1 hashes of ...
4
votes
2answers
288 views

Generating file with ASCII numbers using /dev/urandom?

How can I generate 10 MB files from /dev/urandom filled with: ASCII 1s and 0s ASCII numbers between 0 and 9
3
votes
1answer
808 views

How to debug random reboots, with no kernel panic, of an embedded system?

I have two aValue RPC-10W1 embedded systems that reboots by themselves after 1-2 hours. Facts: The board will reboot within a time span of 1 to 2½ hours. The issue is present on two identical ...
16
votes
2answers
2k views

Why writing to /dev/random does not make parallel reading from /dev/random faster?

Typically reading from /dev/random produces 100-500 bytes and blocks, waiting for an entropy to be collected. Why doesn't writing information to /dev/random by other processes speed up reading? ...
11
votes
5answers
15k views

Generate random numbers in specific range

After googling a bit I couldn't find a simple way to generate with a shell command a random number included in a specific range, between a minimum and a maximum. I read about /dev/random, ...
8
votes
2answers
2k views

Adding “random number entropy” for GPG keys?

In the following video: Linux HOWTO: Secure Your Data with PGP, Part 2, you are shown how to create a key pair with gpg. At about 1:50, the instructor says the following: While the key is being ...
1
vote
0answers
120 views

xdotool random/more natural delay?

For automated testing of some applications, I would like to emulate the users behaviour. I know I can user the xdotool type --delay option, but I would like a more natural delay. The easiest thing ...
2
votes
4answers
494 views

Overwriting a Disk

Should I use: find / -type f -exec shred -uvz -nX or just good old dd if=/dev/urandom of=/dev/sda Is one faster or more secure than the other?
7
votes
1answer
181 views

/usr/bin/random using a lot of CPU

Using QNX 6.4.1, there is a command called pidin times that shows information about processes. I think it means PID INformation. Among other things, you can see how much CPU a process has used since ...
6
votes
1answer
252 views

Can you explain the entropy estimate used in random.c

/dev/random uses the timings of kernel interupts to add to the entropy pool. The amount of entropy in the pool is tracked in a variable named entropy_count. Here is the relevant snippet of code from ...
7
votes
2answers
2k views

Create random data with dd and get “partial read warning”. Is the data after the warning now really random?

I create a 1TB file with random data with dd if=/dev/urandom of=file bs=1M count=1000000. Now I check with kill -SIGUSR1 <PID> the progress and get the following: 691581+0 Datensätze ein ...
7
votes
2answers
2k views

RSA 2048 keypair generation: via openssl 0.5s via gpg 30s, why the difference?

RSA 2048 keypair generation: via openssl 0.5s via gpg 30s, why the difference There are several programs which can gerate RSA public/private keypairs GnuPG/OpenPGP for instance has a wizzard being ...
4
votes
1answer
213 views

measure amount of data read from /dev/random

background I have written a collection of bash scripts (most of them in German only yet but if you are interested; download the archive not the single scripts) which help users create high-quality ...
11
votes
3answers
7k views

Reading from /dev/random does not produce any data

I often use the command cat /dev/urandom | strings --bytes 1 | tr -d '\n\t ' | head --bytes 32 to generate pseudo-random passwords. This doesn't work with /dev/random. Specifically cat ...
5
votes
1answer
75 views

What does this command actually cause?

Once while talking with my friend I was trying to joke that we might stand a better chance of completing our project if we just run loads of random programs and expect one of them to solve our ...
11
votes
4answers
830 views

Shuffle file randomly with some additional constraints

I have a huge music playlist and, while some artists have many albums, others have just one song. I wanted to sort the playlist so the same artist won't play twice in a row, or his songs won't end up ...
6
votes
2answers
2k views

What keeps draining entropy?

If I do watch cat /proc/sys/kernel/random/entropy_avail I see that my systems entropy slowly increases over time, until it reaches the 180-190 range at which point it drops down to around 120-130. The ...
2
votes
1answer
592 views

Use the raspberry pi as a source of entropy for /dev/random

I'm trying to see if I can use my raspberry pi's hardware RNG as a source of entropy for /dev/random. Mostly to see if I can get it to work and find yet another use for this nifty little device. Of ...
2
votes
2answers
206 views

Feeding /dev/random with disk reads etc

Is there any way to feed /dev/random with sufficient entropy? The data doesn't have to be truly random, i.e. I can append time of day with pid and add 27 to it, it doesn't matter I just want to make ...
1
vote
1answer
669 views

Starting rng-tools in SLES guest in VirtualBox

I am trying to start rng-tools in a SLES 11 SP3 installation inside of VirtualBox. vagrant@sles11sp3x64:~> uname -a Linux sles11sp3x64 3.0.93-0.8-default #1 SMP Tue Aug 27 08:44:18 UTC 2013 ...
5
votes
2answers
568 views

How to determine which processes are using how much entropy from /dev/urandom

Doing fuser -v /dev/urandom tells me which processes currently have /dev/urandom open, but only that. Is there any was to determine anything about how much entropy each one is using up over time? ...
0
votes
1answer
89 views

Random bug in Linux

Some time ago, I remember reading an article on randomization in computing, and how random you can actually get a system to be. The article came about, if I'm not mistaken, because of some seemingly ...
0
votes
2answers
132 views

Daemon not running when started over ssh

I'm trying to start the rngd daemon by remotely starting it via ssh. Unfortunately it does not seem to run until I log onto the machine. The command I'm using is: ssh -n -o StrictHostKeyChecking=no ...