LinuxQuestions.org

LinuxQuestions.org (/questions/)
-   Linux - Newbie (https://www.linuxquestions.org/questions/linux-newbie-8/)
-   -   Making Random Variables (https://www.linuxquestions.org/questions/linux-newbie-8/making-random-variables-670011/)

bioinformatics_guy 09-15-2008 06:38 AM

Making Random Variables
 
Im rerunning a shell script under different options (which at first I thought I could solely use as a unique identifier, but realised my process is stochastic by nature so even identical start variables will give slightly different results) and wanted to know what you prefer? I was trying to find a random number/ASCII generator or putting a time stamp on it. Which is better and what command would I use to get it?

bioinformatics_guy 09-15-2008 06:41 AM

I forgot to mention, I am using bash. Not sure if the command would be a coreutil or bash specific so I thought I should put that out there.

theYinYeti 09-15-2008 07:09 AM

Using bash, you can use the $RANDOM variable.
Quote:

RANDOM Each time this parameter is referenced, a random integer between
0 and 32767 is generated. The sequence of random numbers may be
initialized by assigning a value to RANDOM. If RANDOM is unset,
it loses its special properties, even if it is subsequently
reset.
Yves.


All times are GMT -5. The time now is 03:24 PM.