re: Write a simple but impactful script VIEW POST

FULL DISCUSSION
 

Hacky Perl/sh oneliner

perl -e '@v=("0000".."9999"); %x; print map { do { $i=int(rand(@v)); } while($x{$i}); $x{$i}=1; $v[$i] . "\n"} @v;' > hacked_pins.txt

Generates a list of pins (@v) and then selects a random entry for every entry in the list (hacky use of map). %x is used to mark which entries already have been returned.

code of conduct - report abuse