rand: Parallelize generation.
This commit is contained in:
parent
5bc35e8870
commit
90946afc5b
11
rand/rand
11
rand/rand
|
@ -68,6 +68,11 @@ B<openssl>
|
||||||
|
|
||||||
# Generate random 8-bit data by AES encrypting /dev/zero with a random
|
# Generate random 8-bit data by AES encrypting /dev/zero with a random
|
||||||
# key
|
# key
|
||||||
key=$(openssl rand -hex 16)
|
randfunc() {
|
||||||
iv=$(openssl rand -hex 16)
|
key=$(openssl rand -hex 16)
|
||||||
< /dev/zero openssl enc -aes-128-ctr -K $key -iv $iv 2>/dev/null
|
iv=$(openssl rand -hex 16)
|
||||||
|
< /dev/zero openssl enc -aes-128-ctr -K $key -iv $iv 2>/dev/null
|
||||||
|
}
|
||||||
|
export -f randfunc
|
||||||
|
# Boost performance by running 1 per CPU core
|
||||||
|
eval parallel -u randfunc ::: {1..$(parallel --number-of-cores)}
|
||||||
|
|
Loading…
Reference in a new issue