Secure OS Software for Linux
Showing results for 
Search instead for 
Did you mean: 

random function


random function

hi all,

how to use RANDOM function in bash?
for example i have couple words:
vegas­harrahs, venture capital, viagra, v1agra, vi@gra, vi*agra,
viagr@, vicodin, video professor, violence, vioxx, virginity*, virus alert,
virus detected

and i want to use RANDOm function to create as many possible words there can be plus using numbers 0-9.

I want to create database for keyword filtering in exchange.
Stuart Browne
Honored Contributor

Re: random function

Err, I'm not sure what you're wanting to do with it, but 'RANDOM' in Bash isn't a function, it's an environment variable.

So long as it doesn't get unset, it will be set to a value between 0 and 32767.

The simple test is: echo $RANDOM

Read the 'man bash' page for further details, such as seeding.
One long-haired git at your service...
Andrew Cowan
Honored Contributor

Re: random function

There is no built-in shell function to create entropy data, however you can cat /dev/random and /dev/urandom and then write your own routine.

if you check out Perl there are some functions to do this for you.