Secure OS Software for Linux
1753952 Members
7851 Online
108811 Solutions
New Discussion юеВ

Re: random function

 
kabucek
Advisor

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.
thanks
2 REPLIES 2
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.