Questions tagged [random]

UNIX random devices and utilities

Filter by
Sorted by
Tagged with
0
votes
0answers
11 views

rngd is running with /dev/hwrng; boot hangs long at “Initalizing entropy source hwrng”

My i.MX6 machine with yocto linux takes horribly long to boot. On the console I can see that it's hanging at initializing the hardware random number generator: Starting system message bus: [ 8....
0
votes
0answers
12 views

raid1 config boots 'randomly' from either one of the drives

So I recently set up a linux machine with two HDD's in raid1 config. Turns out, when the machine boots one time it picks one of the two disks and the other time it picks the other for some reason. How ...
6
votes
2answers
698 views

Reading from dev/urandom - system behaviour

When reading from dev/urandom, with say head or dd, it’s of course expected that the output is always random and different. How is this handled by UNIX at a low level? Is the file naturally truncated ...
0
votes
2answers
56 views

generate a password with minimum 2 numbers, 2 CAPS, 1 symbol, x lower alpha and max length of 16

I tried pwgen and makepasswd to generate a password... but these are not enough to generate with exact count of literals and numbers... pwgen -c -n -y -B 12 1 This is not working as expected as I ...
0
votes
1answer
46 views

Write all numbers between 0 and large number (both inclusive) to a file in random order

For simulation I am trying to do, I want a text file with numbers ranging from 0 to 2^33 which is a huge number. I have used this command: seq 0 Number >> OUTPUT FILE But this is very slow. ...
0
votes
0answers
17 views

ARM64: Does EFI-Stub choose any address calculated with a random number?

[ARM64] I am trying to boot the kernel from GRUB and it goes through the EFI-Stub loader. The EFI bootloader I am using includes an implementation for EFI_RNG_PROTOCOL and CONFIG_RANDOMIZE_BASE is ...
5
votes
1answer
207 views

Generate a random time between 00:00:20 and 10:10:00

I want to generate a somewhat random time signature in a bash script using a variable. I've got a video file that's 11 hours long and I'll be muxing a 50-minute mp3 podcast that I download most ...
2
votes
1answer
106 views

How to cat a specific tone to /dev/audio?

cat /dev/urandom generates a random sequence of all possibles "values". cat /dev/urandom | padsp tee /dev/audio > /dev/null directs these "values" to your audio device, turning them into "random ...
1
vote
1answer
140 views

Select a random file from the file system [duplicate]

Is there a way to get the path of a random file from the entire file system (either from a single partition or everything under /), in a reasonable time?
0
votes
1answer
468 views

Run two commands one after another in bash

I am facing problems running two commands one after another in bash. When i run source2() { '/home/ds/Documents/scripts/Untitled Document 1.sh' && imgpath="$(ls | grep "^unsplash")" } ...
0
votes
2answers
89 views

How can i store commands as a variables and execute them randomly in bash?

How can i store commands as a variables and execute them randomly in bash? command1=" convert -size 2000x1000 xc:none -gravity center \ -stroke yellow -pointsize 50 -font Courier-BoldOblique -...
3
votes
2answers
58 views

Help with Kindle e-ink - display random image file

I am a complete newby to this but I'm trying to adapt someone else's code for a jail broken Kindle 3 (e-reader). I am using the following code to generate a random(ish) number between 0 to X (where X ...
0
votes
1answer
1k views

4000x “wpa_supplicant[1885]: random: Cannot read from /dev/random: Resource temporarily unavailable” log message when booting

I recently added Linux Mint (19.3) as my new main OS on my Sony Vaio notebook. Sometimes booting takes a bit of time and I found in jounrnalctl: Feb 11 10:45:11 notebook kernel: microcode: microcode ...
0
votes
2answers
218 views

Can you feed urandom to dd for wiping a drive but skip every other block to speed it up?

I've been wiping a large number of old laptops for donation/recycling. To do so I boot up to a Linux live CLI from USB or CD and use dd if=/dev/urandom of=/dev/sda status=progress to overwrite the ...
0
votes
2answers
120 views

Why does it take longer to create a file with random text than with zeros?

i recently created a test file, because I wanted to play around with logrotate. I was searching for a solution to create a file with any size I want. I found out that this is my solution: dd if=/dev/...
2
votes
0answers
83 views

Do Mediatek SoCs (specifically MT7628) have linux accessible RNG hardware?

I am dealing with a custom board based on a MT7628AN SoC. Currently it takes a LOOOOOOONG time to initialize the entropy pool: [ 1857.972285] random: crng init done That is about half an hour! I ...
4
votes
1answer
203 views

Returning randomised items from glob match

With the glob qualifiers in zsh one can sort the results of a filename globbing pattern match in various ways. For example, the pattern *(om) would match all non-hidden names in the current directory,...
3
votes
1answer
189 views

Immediate effect of writing to /dev/random

For reasons best described as philosophical, I'd like to know the following. Assume I am going to read from /dev/random (or /dev/urandom) at time X. In one scenario I just do that, but in another, ...
13
votes
5answers
2k views

How could a sequence of random dates be generated, given year interval?

What is needed here is a command that generates six dates given a range of years (1987 to 2017). For example: 12/10/1987 30/04/1998 22/02/2014 17/08/2017 19/07/2011 14/05/2004 How it could be done, ...
2
votes
1answer
180 views

Adding entropy to /dev/random

I'm in the process of designing and building a quantum random number generator for high security applications (and potentially data centres). As part of this, I would like to feed the random numbers ...
2
votes
1answer
398 views

How can I speed up random init? [duplicate]

I have an embedded device running a linux environment built with Yocto. I have both openssh-server and nginx running, both of which take 1 minute to start because they are waiting on enough entropy: ...
3
votes
1answer
899 views

Linux embedded: boot stopped by “crng init” for LOOOOONG time

I am having heavy problems similar to what discussed in this question. In my case though, I have a very recent kernel (5.3) for a small embedded processor (mips, mt7628) and boot process stops for ...
-1
votes
2answers
202 views

Creating random file in just one line but with specific length

I want to make a file (random content) but with just one 1 MB large line inside it I have tried using this command but it didn't work : head -n 1 -c 1m /dev/urandom > /sdcard/file.txt How ...
15
votes
5answers
2k views

How to run a command 1 out of N times in Bash

I want a way to run a command randomly, say 1 out of 10 times. Is there a builtin or GNU coreutil to do this, ideally something like: chance 10 && do_stuff where do_stuff is only executed 1 ...
0
votes
0answers
108 views

FreeBSD: how can I check if `/dev/random` is blocking?

So this exact question has been asked many times about Linux's implementation of /dev/random, but I am struggling to find an answer that is FreeBSD specific. From the FreeBSD random(4) man page: ...
10
votes
2answers
3k views

Is dd if=/dev/urandom of=/dev/mem safe?

What exactly does this do? I don't understand how you could access base memory with this...seems kinda weird. Is it safe? dd if=/dev/urandom of=/dev/mem
2
votes
0answers
69 views

How to grep an eternal string coming from STDIN

Using bash i'm trying to grep a string coming from /dev/urandom something like this: tr -cd '[:lower:]' < /dev/urandom | grep -o 'test' Also tried: tr -cd '[:lower:]' < /dev/urandom | grep -o ...
15
votes
2answers
4k views

Why am I getting unevenly-spread results when using $RANDOM?

I read about RNGs on Wikipedia and $RANDOM function on TLDP but it doesn't really explain this result: $ max=$((6*3600)) $ for f in {1..100000}; do echo $(($RANDOM%max/3600)); done | sort | uniq -c ...
0
votes
1answer
648 views

Bash: how to avoid duplicate result from random list?

Suppose a script like this #!/bin/bash array[0]="123" array[1]="333" array[2]="5566" array[3]="135" array[4]="68" array[5]="45" array[6]="78" array[7]="32" array[8]="190" number() { size=${#array[@]}...
2
votes
1answer
52 views

How should I go about safely checking if performing dd on /dev/random is going to block?

I'm developing a shell script that only uses /dev/random in the following manner: dd if=/dev/random of=%{outputFile} count=512 bs=1 2>/dev/null I explicitly do not want to use /dev/urandom, even ...
4
votes
4answers
2k views

Using sed to replace “A” with a “B” or “C”

This should be straight-forward, but I cannot figure it out. If I want to replace an A or B with a C using sed the code could potentially be: $ echo AAXXAAYYBB | sed 's/[AB]/C/g' CCXXCCYYCC This ...
1
vote
1answer
2k views

RPi + Buildroot: random: crng init done (not enough entropy) - how to configure rng-tools

I'm designing a minimal custom Buildroot embedded OS for the RPi0w. My current iteration takes a very long time to fully boot - several minutes with a keyboard and mouse plugged in, and tens of ...
1
vote
3answers
99 views

Replace the last alphanumeric with a random char of same type [closed]

I have a simple list of alphanumeric machine names in a file, and I want to change the last letter or number, but I want it to match character type -- so if the last character is a digit, it should be ...
2
votes
2answers
225 views

Feed /dev/random by Octeon RNG

The device is Octeon by Cavium which contains a RNG hardware unit. OS shows that the current entropy pool size is 4096 bytes but entropy_avail is very low. The device crypto modules has ansi_cprng.ko ...
0
votes
1answer
57 views

Increase entropy_avail on Cavium

The device is Octeon by Cavium which contains a RNG hardware unit. OS show Current entropy pool size is 4096 bytes but entropy_avail is very low.The device crypto modules has ansi_cprng.ko present ...
0
votes
1answer
153 views

PRNG not seeded (on SCO OpenServer 5.0.7 MP5)

On SCO OpenServer 5.0.7 MP5, upon attempting use of any ssh-based utility, the following is returned, and any intended SSH connection does not occur: PRNG not seeded How is this resolved (the ...
0
votes
0answers
148 views

randomly generated words to a form using curl

What I want to achieve is to post a form containing 3 fields (forename, surname and email) to a url, but i want the entries to be randomly generated. I want to generate a random word using; { head /...
2
votes
4answers
2k views

How to shuffle file names randomly in a directory

Say i have a directory of filenames: file_010.ext file_011.ext ... file_99.ext What's the simplest way to take each file and randomly rename it to any other name in the directory, without there ...
8
votes
2answers
9k views

Create unique random numbers (UUIDs) in bash

I want to create random unique numbers (UUIDs) as the following node.id=ffffffff-ffff-ffff-ffff-ffffffffffff First I tried this $ rndnum=` echo $RANDOM"-"echo $RANDOM"-"echo $RANDOM"-"echo $RANDOM"-...
-3
votes
1answer
801 views

random test log generator [closed]

I need to write a script to create random test log data. Log data should be delimited with "|"(pipe) and 10,000 lines with 500 bytes, and each line and contain following format with random data. ...
6
votes
2answers
344 views

How do I specify chance when setting a variable to random item in array?

Currently I do something like this to set a variable to a random item in an array: array=("foo" "bar" "baz") var=${array[$RANDOM % ${#array[@]} ]} How would I do if I want to set $var to one of ...
0
votes
0answers
59 views

Pick random row from a file [duplicate]

How do I pick a random row of text from a file?
1
vote
1answer
449 views

Does the size of the random_source file matter?

Some GNU coreutils utilities like sort and shuf use a file as what effectively serves a seed. Does the size of the file matter? The recommended way, https://www.gnu.org/software/coreutils/manual/...
1
vote
1answer
440 views

Weird behavior in zsh random generator

I have this script to generate $1 digit(s) of mixed random char from the defined charlists as arrays. #!/bin/bash charlist1=(a b c d e f g h i j k l m n o p q r s t u v w x y z) charlist2=(0 1 2 3 4 ...
6
votes
1answer
9k views

Debian Testing takes a long time to load. Crng init done [closed]

Debian Testing takes a long time to load. Here is a fragment of the dmesg log. kernel - 4.17 [ 11.296697] audit: type=1400 audit(1533745556.133:9): apparmor="STATUS" operation="profile_load" ...
8
votes
3answers
2k views

My script produces the same output when using $RANDOM

I am trying to print a random n letter word, where I input n from the command line itself, but for some reason my script is giving me the same answer every time when using the same value for n. #!/...
1
vote
2answers
2k views

Generate random password with special characters on Solaris

I am trying to generate a 10-character random password in Solaris servers. The examples give around the web are for Linux and mostly not working in Solaris.
3
votes
1answer
288 views

Snail rate of “entropy creation” not increasing significantly with rng-tools

The rate of "entropy creation" on my system (Linux 4.13.0-38-generic, 16.04.1-Ubuntu, Intel® Celeron(R) CPU G3930 @ 2.90GHz × 2, main disk is SSD) is an impractically slow much less than 1 bit per ...
0
votes
1answer
171 views

If /dev/random is implemented as a pseudo-device, why isn't “yes”? [closed]

yes produces a stream of "y" chars, or other requested. If Unixen have a pseudodevice for random numbers, why not useful streams like this too?
-3
votes
1answer
153 views

Eval not working

i try run this code to get random number but eval seems not working this is my code #!/bin/bash # Sequencia alfanumerica de 12 carateres aleatoriamente (maiusculas e minusculas) file="/home/...