Friday, June 24, 2016

Create a file with random numbers

Sometimes we need to create a file that contains several random numbers. Using bash programming we can do that very quickly. Example,

mycomputer ~% for i in {1..1000}; do echo $RANDOM; done >> nums.txt

This command executes a for loop 1000 times, prints the random variable $RANDOM and redirect the output to the file nums.txt

No comments:

Post a Comment