Skip to content
Better HN
Top
New
Best
Ask
Show
Jobs
Search
⌘K
undefined | Better HN
0 points
em500
5y ago
0 comments
Share
If you're importing from command line tools, you might as well use the specialized `shuf` tool:
shuf -i 1-$bignum
or for random numbers with replacement
shuf -i 1-$bignum -r -n $bignum
These give you a sample of random integers. `shuf` is part of GNU coreutils, so present in most Linux installs (but not on macOS).
0 comments
default
newest
oldest
fouc
5y ago
It's worth installing GNU coreutils on macOs All the command names are prepended with g, so `gshuf`
jeffbee
5y ago
Nice yeah that's a good way. Generally the number 1 million is so small I see no reason to do this in any manner other than shell commands.
j
/
k
navigate · click thread line to collapse