Sample Header Ad - 728x90

Unix & Linux Stack Exchange

Q&A for users of Linux, FreeBSD and other Unix-like operating systems

Latest Questions

136 votes
14 answers
276236 views
Generate random numbers in specific range
After googling a bit I couldn't find a simple way to use a shell command to generate a random decimal integer number included in a specific range, that is between a minimum and a maximum. I read about `/dev/random`, `/dev/urandom` and `$RANDOM`, but none of these can do what I need. Is there another...
After googling a bit I couldn't find a simple way to use a shell command to generate a random decimal integer number included in a specific range, that is between a minimum and a maximum. I read about /dev/random, /dev/urandom and $RANDOM, but none of these can do what I need. Is there another useful command, or a way to use the previous data?
BowPark (5155 rep)
Jul 4, 2014, 12:18 PM • Last activity: Jul 29, 2025, 08:39 AM
1 votes
3 answers
1830 views
Putting the contents of /dev/urandom into a variable?
This is a follow on from my previous thread :- https://unix.stackexchange.com/questions/651412/passing-date-command-into-a-variable Ok so effectively I would like /dev/urandom to generate 4 digits for me. And place them into a variable. Here is an example of my bash script :- ``` #!/bin/bash for ((...
This is a follow on from my previous thread :- https://unix.stackexchange.com/questions/651412/passing-date-command-into-a-variable Ok so effectively I would like /dev/urandom to generate 4 digits for me. And place them into a variable. Here is an example of my bash script :-
#!/bin/bash
for (( c=0; c<=10; c++))
do
        a="$(tr -dc '[:digit:]' < /dev/urandom | fold -w 4)"

        echo $a
done
The only reason I wish to "Echo" the results is so I can actually see that /dev/urandom has generated 4 digits for me correctly. For my bash script I wish to make, I need to do this programmatically as I wish to do further operation's on the generated results. So I need not "Echo" the results. so is a="$(tr -dc '[:digit:]' < /dev/urandom | fold -w 4)" Actually placing 4 random digits into the variable "a"? when I Echo "a" from my script I just get a hanging console and have to use "CTRL+C" to bring my console back. All I am trying do is place 4 random digits from /dev/urandom into a variable. I m a new to bash scripting so all advice welcome and thank you in advanced for any help or suggestions.
Shanzem (35 rep)
Jun 22, 2021, 09:02 AM • Last activity: Jul 16, 2025, 02:32 AM
3 votes
5 answers
651 views
Randomly pick single line from multiple lines while assigning value to environment variable
In a certain script that we run routinely we configure hostnames in environment variables. Since hostnames can change overtime, we try to dynamically pick the current set of hosts using linux's command substitution using backticks ``` `` ``` ``` export EU_GAMMA_HOST_NAME=` ` ``` *Can't share ` ` sin...
In a certain script that we run routinely we configure hostnames in environment variables. Since hostnames can change overtime, we try to dynamically pick the current set of hosts using linux's command substitution using backticks
``
export EU_GAMMA_HOST_NAME=``
*Can't share `` since it uses proprietary tools* ----- Originally when we wrote the script there used to be a single host that would get picked and its hostname assigned to our env-var, but now there are multiple hosts such that a list of hostnames (one per line) gets assigned to our env-var, resulting in failure of our script and requiring us to manually fix the value of environment variable We tried adding | head -1 at the end of our command but then it would always use the same host, which we don't want.
export EU_GAMMA_HOST_NAME= | head -1
----- How can I randomly pick a single hostname out of list of hostnames while assigning the command-substitution value to my environment variable?
y2k-shubham (359 rep)
Jun 4, 2025, 05:22 AM • Last activity: Jun 28, 2025, 02:00 AM
12 votes
2 answers
1061 views
Why do I need rngd random number generator daemon?
I run a Raspberry Pi with a custom [Yocto][1] Linux. There's an `rng-tools.service` which runs [`rngd`][2]. On my Pi, it shows high CPU usage sometimes and [others][3] [complain][4] about its excessive logging. Before trying to fix those issues, I considered to simply remove the service. However, th...
I run a Raspberry Pi with a custom Yocto Linux. There's an rng-tools.service which runs rngd . On my Pi, it shows high CPU usage sometimes and others complain about its excessive logging. Before trying to fix those issues, I considered to simply remove the service. However, there's very sparse information on the tool and consequences of removing it available online. Why do I need to have rngd running? What consequences do I face, when removing it? #### Research and Assumptions Most online man pages are outdated, but having a look in the code repository I find the following: > This is a random number generator daemon. > > It monitors a set of entropy sources, and supplies entropy from them to the system kernel's /dev/random machinery. Operation is fully documented in the man page, and should be fairly intuitive While the current man page is easy to follow, understanding it requires domain knowledge that exceeds mine. I know that I need "good" entropy to generate secure cryptographic keys (e.g. for SSH); there's another question that explains the details. But why do the system's entropy sources need "monitoring" and feeding into /dev/random? If I stop the service, cat /dev/random still works. On an Ubuntu host with Intel processor, rngd isn't even installed by default. Assuming Ubuntu is secure, some hardware seems to do fine without rngd. The most useful information I found in this Red Hat article . Accordingly rngd is _"capable of using both environmental noise and hardware random number generators for extracting entropy"_ and _"checks whether the data supplied by the source of randomness is sufficiently random"_. To me this means that rngd improves the randomness of /dev/random. With the prior observation of rngd missing on Intel based systems, I assume that the Pi's hardware random number generator is not "good" enough and rngd is there to improve the situation. I'll probably disable the service anyways, because the Pi is on a LAN with my Desktop PC only. Still, I'm curios to learn if I should do this on a more exposed device and wanted to document my findings for others. #### Try it out In order to test the quality of the randomness, the article mentions rngtest. Hence, I run the test a few times, each block with rng-tools.service either enabled or disabled (see below). The values vary a little, but among runs they stay in the same ball park. To me this does not like there's any significant difference. There are some timing statistics, but they don't show any significant difference as well. Collect the data:
for i in $(seq 0 4); do cat /dev/random | rngtest -c 10000 2>> ./run_enabled; done
systemctl stop rng-tools
for i in $(seq 0 4); do cat /dev/random | rngtest -c 10000 2>> ./run_disabled; done
Some example results: (Did a few more runs and the numbers seem to depend more on the time of the run than on the service being enabled)
# grep failure run_disabled 
rngtest: FIPS 140-2 failures: 7
rngtest: FIPS 140-2 failures: 6
rngtest: FIPS 140-2 failures: 8
rngtest: FIPS 140-2 failures: 5
rngtest: FIPS 140-2 failures: 2
# grep failure run_enabled
rngtest: FIPS 140-2 failures: 9
rngtest: FIPS 140-2 failures: 8
rngtest: FIPS 140-2 failures: 8
rngtest: FIPS 140-2 failures: 7
rngtest: FIPS 140-2 failures: 5

# grep "input channel speed" run_disabled
rngtest: input channel speed: (min=22.842; avg=2846.662; max=9536.743)Mibits/s
rngtest: input channel speed: (min=27.845; avg=2778.812; max=6357.829)Mibits/s
rngtest: input channel speed: (min=28.425; avg=2886.991; max=6357.829)Mibits/s
rngtest: input channel speed: (min=51.273; avg=2530.815; max=4768.372)Mibits/s
rngtest: input channel speed: (min=42.292; avg=2509.867; max=4768.372)Mibits/s
# grep "input channel speed" run_enabled
rngtest: input channel speed: (min=23.812; avg=2853.049; max=6357.829)Mibits/s
rngtest: input channel speed: (min=27.643; avg=2704.117; max=6357.829)Mibits/s
rngtest: input channel speed: (min=27.444; avg=2722.567; max=9536.743)Mibits/s
rngtest: input channel speed: (min=28.383; avg=2815.690; max=6357.829)Mibits/s
rngtest: input channel speed: (min=28.049; avg=2844.284; max=6357.829)Mibits/s

# grep "tests speed" run_disabled
rngtest: FIPS tests speed: (min=25.130; avg=54.219; max=55.446)Mibits/s
rngtest: FIPS tests speed: (min=27.093; avg=53.990; max=55.285)Mibits/s
rngtest: FIPS tests speed: (min=20.056; avg=48.995; max=55.285)Mibits/s
rngtest: FIPS tests speed: (min=32.493; avg=51.283; max=55.285)Mibits/s
rngtest: FIPS tests speed: (min=26.676; avg=51.326; max=55.285)Mibits/s
# grep "tests speed" run_enabled
rngtest: FIPS tests speed: (min=48.165; avg=54.621; max=55.446)Mibits/s
rngtest: FIPS tests speed: (min=19.443; avg=49.054; max=55.285)Mibits/s
rngtest: FIPS tests speed: (min=24.803; avg=54.375; max=55.446)Mibits/s
rngtest: FIPS tests speed: (min=20.035; avg=49.008; max=55.285)Mibits/s
rngtest: FIPS tests speed: (min=30.469; avg=54.625; max=55.446)Mibits/s
Mo_ (257 rep)
Jun 19, 2025, 09:39 AM • Last activity: Jun 24, 2025, 10:12 PM
9 votes
4 answers
11979 views
How to pick a random element from the output of a command?
If I have something like: echo 1 2 3 4 5 6 or echo man woman child what do I have to put behind the pipe to pick out one element of `1 2 3 4 5 6` or `man woman child`? echo 1 2 3 4 5 6 | command 3
If I have something like: echo 1 2 3 4 5 6 or echo man woman child what do I have to put behind the pipe to pick out one element of 1 2 3 4 5 6 or man woman child? echo 1 2 3 4 5 6 | command 3
Abdul Al Hazred (27600 rep)
Mar 13, 2016, 12:14 AM • Last activity: Jun 5, 2025, 08:03 AM
2 votes
4 answers
229 views
Executing a cron task once a month at a random date and time
Ubuntu 22.04 or AlmaLinux 9.5 I've seen a lot of questions about running scripts in random times during a day using bash's $RANDOM but a month exceeds the limit it has. How can I do that? It is a `xdg-open`command to be executed no more than twice a month (exceptionally more in case of power off), a...
Ubuntu 22.04 or AlmaLinux 9.5 I've seen a lot of questions about running scripts in random times during a day using bash's $RANDOM but a month exceeds the limit it has. How can I do that? It is a xdg-opencommand to be executed no more than twice a month (exceptionally more in case of power off), any day, any time, random, not the same date every month. The time between 2 consecutive tasks must not be more than 30 days.
Daniel Stonek (21 rep)
Apr 29, 2025, 12:33 AM • Last activity: May 14, 2025, 01:02 PM
4 votes
3 answers
2111 views
Create Numbers 1-6 in random order using AWK
I'm using AWK to generate values between 1 - 6 which need to come out in random order. I have managed to sort out the logic for the creation of the right range of numbers but am struggling with reading those in to an array to prevent duplicate numbers being output. Currently my code has this;- BEGIN...
I'm using AWK to generate values between 1 - 6 which need to come out in random order. I have managed to sort out the logic for the creation of the right range of numbers but am struggling with reading those in to an array to prevent duplicate numbers being output. Currently my code has this;- BEGIN{ FS="" }{ for (i=1; i<=6; ++i) { v=(int (rand()*6)+1 print v } This currently outputs six numbers but shows duplicates 2, 2, 6, 1, 4, 2. What I need the output to be is something like 1, 4, 2, 5, 6, 3 Can anyone please help with the array side of this for my AWK program? Many thanks
Jonathan B (59 rep)
May 6, 2021, 01:21 PM • Last activity: May 2, 2025, 11:14 AM
660 votes
26 answers
767517 views
How to generate a random string?
I would like to generate a random string (e.g. passwords, user names, etc.). It should be possible to specify the needed length (e.g. 13 chars). What tools can I use? (For security and privacy reasons, it is preferable that strings are generated off-line, as opposed to online on a website.)
I would like to generate a random string (e.g. passwords, user names, etc.). It should be possible to specify the needed length (e.g. 13 chars). What tools can I use? (For security and privacy reasons, it is preferable that strings are generated off-line, as opposed to online on a website.)
landroni (11586 rep)
Sep 19, 2015, 08:06 AM • Last activity: Apr 4, 2025, 03:21 PM
1 votes
2 answers
147 views
systemd-random-seed.service takes a lot of time to start / timeout
I have a Linux device with several services of my own. Kernel: `4.14.151` `systemd`: `systemd 249 (249.11-0ubuntu3.12)` My services are written as `sysvinit` services and automatically generated as `systemd` services using the `/run/systemd/generator.early`. Everything worked fine until I wanted to...
I have a Linux device with several services of my own. Kernel: 4.14.151 systemd: systemd 249 (249.11-0ubuntu3.12) My services are written as sysvinit services and automatically generated as systemd services using the /run/systemd/generator.early. Everything worked fine until I wanted to call /usr/bin/ssh-keygen -t ed25519 ... from one of my services. At that moment, my call to ssh-keygen gets blocked until systemd-random-seed.service is done. But it's not done, it gets to timeout. So the whole boot takes a lot of time. - I understand systemd-random-seed.service is in charge of starting the entropy pool for randomness, that's why ssh-keygen is blocked. - But, why do they go into dead lock? I would expect systemd-random-seed.service to finish unrelated to ssh-keygen. - Before my changes, systemd-random-seed.service took ~16 seconds. (I can see using systemd-analyze blame and systemd-analyze plot > chain.svg. - After my changes it can get to 10 minutes timeout. - Regardless of my change. Meaning, without adding ssh-keygen call to one of my services, I've tried to remove one of my sysvinit service. Doing that makes systemd-random-seed.service even more unpredictable - it finishes after 2-6 minutes. - My purpose was re-writing my sysvinit service as a systemd service After=systemd-random-seed.service so it will surely pass. The bottom line is systemd-random-seed.service is not clear to me. Can you please explain its behavior? Why doesn't it start regardless of ssh-keygen? How can I start another service after it finishes?
hudac (791 rep)
Mar 13, 2025, 09:30 AM • Last activity: Mar 13, 2025, 04:07 PM
2 votes
2 answers
3108 views
How to generate random master password?
I want to generate a secure random password for the encrypted Linux system. What offline tools should I use? Any advice if I should use `xkcdpass`, `apg`, `diceware`, or another utility, and how built should this password be?
I want to generate a secure random password for the encrypted Linux system. What offline tools should I use? Any advice if I should use xkcdpass, apg, diceware, or another utility, and how built should this password be?
whiteman808 (121 rep)
Jan 23, 2023, 07:52 PM • Last activity: Mar 7, 2025, 03:33 PM
3 votes
4 answers
4155 views
How can I generate random 64-bit signed integer with macOS?
I need to generate some 64-bit signed integer for testing. How can I do this? #!/bin/sh long=$(????)
I need to generate some 64-bit signed integer for testing. How can I do this? #!/bin/sh long=$(????)
Jin Kwon (564 rep)
Dec 23, 2016, 07:55 AM • Last activity: Dec 20, 2024, 06:05 PM
0 votes
1 answers
342 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](https://www.freebsd.org/cgi/man.cgi?query=random&sektion=4): >The generator will start in an unseede...
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](https://www.freebsd.org/cgi/man.cgi?query=random&sektion=4) : >The generator will start in an unseeded state, and will block reads until it is seeded for the first time. This may cause trouble at system boot when keys and the like are generated from random so steps should be taken to ensure a seeding as soon as possible. I ask this question because I would prefer that my scripts exit with an error instead of hanging because /dev/random has not been seeded yet.
Harold Fischer (1974 rep)
Aug 18, 2019, 02:29 AM • Last activity: Oct 21, 2024, 07:00 PM
29 votes
4 answers
49705 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"-"echo $RANDOM` $ echo $rndnum 30380-echo 21875-echo 14791-echo 32193-echo 11503 What is the right way...
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"-"echo $RANDOM $ echo $rndnum 30380-echo 21875-echo 14791-echo 32193-echo 11503 What is the right way to create the following (where f is any number)? ffffffff-ffff-ffff-ffff-ffffffffffff
yael (13936 rep)
Feb 14, 2019, 09:34 AM • Last activity: Jul 1, 2024, 03:48 PM
3 votes
4 answers
1569 views
Rename files to random filenames (but not to checksums)
Sometimes I need to batch rename files on a macOS system to random or pseudo-random filenames, eight lowercase letters and digits only, e.g. from `mcmurdo-station.png` to something like `a12bc0xy.png`. For this, I use CRC32: ``` sh for f in *.png; do mv $f $(crc32 $f); done ``` But there is a drawba...
Sometimes I need to batch rename files on a macOS system to random or pseudo-random filenames, eight lowercase letters and digits only, e.g. from mcmurdo-station.png to something like a12bc0xy.png. For this, I use CRC32:
sh
for f in *.png; do mv $f $(crc32 $f); done
But there is a drawback that if there are two identical files in the same folder, they have same checksums, and so there will be a filename collision. Of course, usually I don't store identical files in the same folder, but I nevertheless would prefer to avoid such over-automatization while batch renaming. Another way I have found on the internet is to use base64:
sh
randomname() { head -c8 /dev/urandom | base64 | tr -dc a-z0-9; }
zmv '(*).(*)' 'randomname.$2'
>2024-05-22 edit: Instead of backquotes, [it is better to use a dollar sign](https://stackoverflow.com/q/9405478) : > >
>zmv '*(.*)' '$(randomname)$2'
>
But the resulting filenames are of different lenght: the first test file was renamed from foo.png to 52rud.png, whereas the second - from bar.png to pxg.png. There is also a solution using shuf from GNU Core Utils: https://unix.stackexchange.com/a/259761 , but for now I would prefer to find a way that don't require installing third-party packages. What is a good and simple alternative?
jsx97 (1347 rep)
May 19, 2024, 04:34 PM • Last activity: May 24, 2024, 07:28 AM
1 votes
0 answers
80 views
AM335X setting of RNG
I kindly request any advice regarding the configuration of the HW RNG of TI AM335X. I'm aiming to achieve security certification for our device, which is based on the PLC Wago PFC200 750-8217. One of the tests involves rngtest of the RNG device /dev/hwrng, and unfortunately, this test isn't passing...
I kindly request any advice regarding the configuration of the HW RNG of TI AM335X. I'm aiming to achieve security certification for our device, which is based on the PLC Wago PFC200 750-8217. One of the tests involves rngtest of the RNG device /dev/hwrng, and unfortunately, this test isn't passing well. I'm requesting advice how to set up the random number generator. Is it possible to configure RNG entropy parameters on already compiled system? root@PFC200V3-5E10C3:~ uname -a
Linux PFC200V3-5E10C3 5.15.107-rt62-w04.02.02 #1 PREEMPT_RT Thu Oct 12 16:23:25 UTC 2023 armv7l GNU/Linux
root@PFC200V3-5E10C3:~ cat /etc/os-release
NAME=PTXdist
VERSION="2020.08.0"
ID=ptxdist
VERSION_ID="2020.08.0"
PRETTY_NAME="PTXdist / WAGO-PFC"
ANSI_COLOR="1;34"

PTXDIST_VERSION="2020.08.0"
PTXDIST_BSP_VENDOR="WAGO"
PTXDIST_BSP_NAME="PFC"
PTXDIST_BSP_VERSION="PFC-trunk"
PTXDIST_PLATFORM_NAME="wago-pfcXXX"
PTXDIST_PLATFORM_VERSION="-trunk"
PTXDIST_BUILD_DATE="2023-10-12T16:43:08+0000"
root@PFC200V3-5E10C3:~ dmesg | grep omap
[    0.000000] Kernel command line: bootversion=2021.10.0-w04.02.00_15 reset_state=RST bootchooser.active=rootfs.1 rw root=/dev/mmcblk1p7 rootfstype=ext4 rootwait uio_pdrv_genirq.of_id=uio_pdrv_genirq  omap_wdt.early_enable omap_wdt.timer_margin=30
[    0.726233] ehci-omap: OMAP-EHCI Host Controller driver
[    0.756679] omap_voltage_late_init: Voltage driver support not added
[    0.880655] omap_wdt: OMAP Watchdog Timer Rev 0x01: initial timeout 30 sec
[    0.999330] omap_uart 481aa000.serial: no wakeirq for uart5
[    1.049123] omap_rng 48310000.rng: Random Number Generator ver. 20
[    1.260657] omap-gpmc 50000000.gpmc: GPMC revision 6.0
[    1.278271] omap-sham 53100000.sham: hw accel on OMAP rev 4.3
[    1.278518] omap-sham 53100000.sham: will run requests pump with realtime priority
[    1.297050] omap-aes 53500000.aes: OMAP AES hw accel rev: 3.2
[    1.297614] omap-aes 53500000.aes: will run requests pump with realtime priority
[    1.324942] omap_reset_deassert: timedout waiting for gfx:0
[    1.337356] omap_hwmod: debugss: _wait_target_ready failed: -22
[    1.337381] omap_hwmod: debugss: cannot be enabled for reset (3)
[    1.337408] omap_hwmod: debugss: _wait_target_ready failed: -22
[    1.344996] omap_uart 44e09000.serial: no wakeirq for uart0
[    1.469816] omap_i2c 44e0b000.i2c: bus 0 rev0.11 at 100 kHz
[    1.496449] sdhci-omap 48060000.mmc: Got CD GPIO
[    1.496576] sdhci-omap 48060000.mmc: Got WP GPIO
[    1.496832] sdhci-omap 48060000.mmc: supply vqmmc not found, using dummy regulator
[    1.505331] sdhci-omap 481d8000.mmc: supply vqmmc not found, using dummy regulator
[   24.163614] omap_uart_rtu 48022000.serial: Initializing Modbus driver
[   24.163652] omap_uart_rtu 48022000.serial: Baudrate = 9600, TO_15 = 2862500ns, TO_35 = 5152500ns
[   24.218985] omap_uart_rtu 48022000.serial: Initializing Modbus driver
[   24.219025] omap_uart_rtu 48022000.serial: Baudrate = 9600, TO_15 = 2862500ns, TO_35 = 5152500ns
## Current setting of RNG root@PFC200V3-5E10C3:~ sysctl kernel.random.poolsize
kernel.random.poolsize = 256
root@PFC200V3-5E10C3:~ sysctl kernel.random.entropy_avail
kernel.random.entropy_avail = 256
## rng-tools tests root@PFC200V3-5E10C3:~ cat /dev/hwrng | rngtest -c 1000
rngtest 5
Copyright (c) 2004 by Henrique de Moraes Holschuh
This is free software; see the source for copying conditions.  There is NO warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.

rngtest: starting FIPS tests...
rngtest: bits received from input: 20000032
rngtest: FIPS 140-2 successes: 999
rngtest: FIPS 140-2 failures: 1
rngtest: FIPS 140-2(2001-10-10) Monobit: 1
rngtest: FIPS 140-2(2001-10-10) Poker: 0
rngtest: FIPS 140-2(2001-10-10) Runs: 0
rngtest: FIPS 140-2(2001-10-10) Long run: 0
rngtest: FIPS 140-2(2001-10-10) Continuous run: 0
rngtest: input channel speed: (min=1.358; avg=2.656; max=2384.186)Mibits/s
rngtest: FIPS tests speed: (min=11.716; avg=32.591; max=36.469)Mibits/s
rngtest: Program run time: 7788534 microseconds
root@PFC200V3-5E10C3:~ cat /dev/hwrng | rngtest -c 1000
rngtest 5
Copyright (c) 2004 by Henrique de Moraes Holschuh
This is free software; see the source for copying conditions.  There is NO warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.

rngtest: starting FIPS tests...
rngtest: bits received from input: 20000032
rngtest: FIPS 140-2 successes: 1000
rngtest: FIPS 140-2 failures: 0
rngtest: FIPS 140-2(2001-10-10) Monobit: 0
rngtest: FIPS 140-2(2001-10-10) Poker: 0
rngtest: FIPS 140-2(2001-10-10) Runs: 0
rngtest: FIPS 140-2(2001-10-10) Long run: 0
rngtest: FIPS 140-2(2001-10-10) Continuous run: 0
rngtest: input channel speed: (min=1.304; avg=2.657; max=2384.186)Mibits/s
rngtest: FIPS tests speed: (min=15.222; avg=32.789; max=36.400)Mibits/s
rngtest: Program run time: 7782633 microseconds
root@PFC200V3-5E10C3:~ cat /dev/hwrng | rngtest -c 1000
rngtest 5
Copyright (c) 2004 by Henrique de Moraes Holschuh
This is free software; see the source for copying conditions.  There is NO warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.

rngtest: starting FIPS tests...
rngtest: bits received from input: 20000032
rngtest: FIPS 140-2 successes: 998
rngtest: FIPS 140-2 failures: 2
rngtest: FIPS 140-2(2001-10-10) Monobit: 1
rngtest: FIPS 140-2(2001-10-10) Poker: 0
rngtest: FIPS 140-2(2001-10-10) Runs: 1
rngtest: FIPS 140-2(2001-10-10) Long run: 0
rngtest: FIPS 140-2(2001-10-10) Continuous run: 0
rngtest: input channel speed: (min=1.328; avg=2.657; max=2384.186)Mibits/s
rngtest: FIPS tests speed: (min=16.820; avg=32.816; max=36.400)Mibits/s
rngtest: Program run time: 7781956 microseconds
bpob (11 rep)
Apr 16, 2024, 10:28 PM • Last activity: Apr 16, 2024, 10:30 PM
20 votes
8 answers
10843 views
Random colors and jokes in the shell/terminal
I saw a person that while using their terminal, it output a joke and changed the colors and laughed at the user. It said something along the lines of leaking colors into the console since (year). I don't remember what it was, but I'd like to use it because the Kubuntu Konsole gets very boring after...
I saw a person that while using their terminal, it output a joke and changed the colors and laughed at the user. It said something along the lines of leaking colors into the console since (year). I don't remember what it was, but I'd like to use it because the Kubuntu Konsole gets very boring after long hours of use, and I'd like to liven things up a bit. Any ideas on what it is/where I can get it? What I'm looking for is something that does it automatically -- without specific input from the user to run a script or command (or even a command run at startup). The thing I'm looking for changed the color themes of the shell at random intervals and joked about the color change. Perhaps it was just a different terminal program (I don't know if that is the right term) than Konsole that is built into Kubuntu.
Undermark5 (217 rep)
Dec 2, 2016, 09:07 AM • Last activity: Mar 20, 2024, 04:18 PM
2 votes
4 answers
3852 views
Random character generation - with random output!
This is what crunch can generate: [user@localhost ~] crunch 3 3 ab Crunch will now generate the following amount of data: 32 bytes 0 MB 0 GB 0 TB 0 PB Crunch will now generate the following number of lines: 8 aaa aab aba abb baa bab bba bbb [user@localhost ~] **But are there any solutions** that is...
This is what crunch can generate: [user@localhost ~] crunch 3 3 ab Crunch will now generate the following amount of data: 32 bytes 0 MB 0 GB 0 TB 0 PB Crunch will now generate the following number of lines: 8 aaa aab aba abb baa bab bba bbb [user@localhost ~] **But are there any solutions** that is the same as crunch, the only difference is that is randomly outputs the lines? [user@localhost ~] SOMEMAGIC 3 3 ab bba bab abb aaa bbb aab baa aba [user@localhost ~] using a "sort -R" like method isn't good! Because the solution needs to be "on the fly"
somelooser28533 (1045 rep)
Oct 17, 2014, 05:24 PM • Last activity: Jan 4, 2024, 08:18 PM
26 votes
2 answers
10775 views
kernel 5.10.119 caused the values of /proc/sys/kernel/random/entropy_avail and poolsize to be 256
After update to kernel 5.10.119, `/proc/sys/kernel/random/entropy_avail` became stuck to 256 and does not change when moving the mouse. It used to be greater than 3000. # cat /proc/sys/kernel/random/entropy_avail 256 Also, `/proc/sys/kernel/random/poolsize` went down to 256. It used to be 4096. Is t...
After update to kernel 5.10.119, /proc/sys/kernel/random/entropy_avail became stuck to 256 and does not change when moving the mouse. It used to be greater than 3000. # cat /proc/sys/kernel/random/entropy_avail 256 Also, /proc/sys/kernel/random/poolsize went down to 256. It used to be 4096. Is this a bug? Can you trust the new random number generator of this kernel with only 256 available entropy?
user528206 (263 rep)
Jun 2, 2022, 02:16 PM • Last activity: Dec 29, 2023, 12:12 PM
2 votes
2 answers
2288 views
How to configure RANDOM for getting the same 32 bit range of random numbers, like by using SRANDOM?
Environment: * Debian * Bash **What is known:** `RANDOM` gives a random number in a range of 15 bits by the following: echo $RANDOM `SRANDOM` gives a random number in a range of 32 bits by the following: echo $SRANDOM `RANDOM` can be configured to create random numbers in a 30-bit range by the follo...
Environment: * Debian * Bash **What is known:** RANDOM gives a random number in a range of 15 bits by the following: echo $RANDOM SRANDOM gives a random number in a range of 32 bits by the following: echo $SRANDOM RANDOM can be configured to create random numbers in a 30-bit range by the following: my_rnd=$(((RANDOM<<15|RANDOM))) echo "$my_rnd" RANDOM can be configured to create random numbers in a 45-bit range by the following: my_rnd=$(((RANDOM<<15|RANDOM)<<15|RANDOM)) echo "$my_rnd" How can I configure RANDOM to get the same 32-bit range of random numbers as I get when using SRANDOM?
Alfred.37 (129 rep)
Jul 21, 2021, 05:45 PM • Last activity: Dec 1, 2023, 09:28 PM
-3 votes
1 answers
258 views
What happens if you put /dev/urandom into a shell script and run it?
I want to know what happens when you run the contents of /dev/urandom as a shell script. I know when you `cat` it into a terminal it will set off a bunch of random things in the terminal environment. Does this work for shell scripts as well?
I want to know what happens when you run the contents of /dev/urandom as a shell script. I know when you cat it into a terminal it will set off a bunch of random things in the terminal environment. Does this work for shell scripts as well?
Bunabyte (111 rep)
Nov 5, 2023, 12:42 AM • Last activity: Nov 5, 2023, 07:21 PM
Showing page 1 of 20 total questions