Skip to content

Instantly share code, notes, and snippets.

@SalemHarrache
Created March 10, 2020 15:46
Show Gist options
  • Save SalemHarrache/181e8ae01616fb43e54911b506087c57 to your computer and use it in GitHub Desktop.
Save SalemHarrache/181e8ae01616fb43e54911b506087c57 to your computer and use it in GitHub Desktop.
#!/bin/bash
hexdump -n 6 -ve '1/1 "%.2x "' /dev/random |\
awk -v a="2,6,a,e" -v r="$RANDOM" '
BEGIN {
srand(r);
}
NR==1 {
split(a, b, ",");
r=int(rand() * 4 + 1);
printf("%s%s:%s:%s:%s:%s:%s\n", substr($1, 0, 1), b[r], $2, $3, $4, $5, $6);
}
'
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment