Just coming across this. I like finding and using old gems. For this, jot does just great.
jot -w %04d 9999 | shuf > /path/to/pins.txt
Or for those on a Mac using GNU coreutils (probably from brew), you'd use gshuf instead of shuf:
jot -w %04d 9999 | gshuf > /path/to/pins.txt
Of course, Ruby is just as elegant:
ruby -e 'puts ("0000"..."9999").to_a.shuffle' > /path/to/pins.txt
... but on my machine the Ruby solution is about 95% slower than the jot version: 148ms vs. 8ms, respectively.
We're a place where coders share, stay up-to-date and grow their careers.
We strive for transparency and don't collect excess data.