# random(3f) [bsd man page]

```RANDOM(3F)																RANDOM(3F)

NAME
random, drandm, irandm - better random number generator

SYNOPSIS
function irandm (iflag)

function random (iflag)

double precision function drandm (iflag)

DESCRIPTION
These  functions use random(3) to generate sequences of random numbers, and should be used rather than the older functions described in man
3f rand.  If iflag is non-zero, it is used as a new seed for the random number generator, and the first new random value is returned.

Irandm returns positive integers in the range 0 through 2147483647 ( 2**31-1).  Random and drandm return values in the range 0. through 1.0
by dividing the integer random number from random(3) by 2147483647 .

FILES
/usr/lib/libF77.a

random(3)

4.3 Berkeley Distribution					   May 15, 1985 							RANDOM(3F)```

## Check Out this Related Man Page

```rand(3C)																  rand(3C)

NAME
rand(), rand_r(), srand() - simple random-number generator

SYNOPSIS
DESCRIPTION
uses  a	multiplicative,  congruential, random-number generator with period 2^32 that returns successive pseudo-random numbers in the range
from 0 to 2^15-1.

can be called at any time to reset the random-number generator to a random starting point.  The generator is initially seeded with a  value
of 1.

returns a random number at the address pointed to by the randval parameter.  The seed parameter can be set at any time to start the random-
number generator at an arbitrary point.

Note
The spectral properties of leave a great deal to be desired.  provides a much better, though more elaborate, random-number  generator  (see
drand48(3C)).

RETURN VALUE
If seed or randval is NULL, returns 0.  Otherwise, returns a psuedo-random integer.

EXAMPLES
The following:

int x, y;
srand(10);
x = rand();
y = rand();

would produce the same results as:

int x, y, s = 10;
x=rand_r(&s);
y=rand_r(&s);

WARNINGS
Users  of  should  note	that  rand_r()	now conforms with POSIX.1c.  The old prototype of is supported for compatibility with existing DCE
applications only.

STANDARDS CONFORMANCE
rand(3C)```
Man Page

## /dev/urandom

Hi, how do I use /dev/urandom to generate a single number between 1-100? I can od /dev/urandom but it gives me an endless list of random numbers, I just want 1 between 1-100. How can I get that? Thanks.

## randomization

I have two files: First file with 10 words, as follow: randomword1, randomword2, randomword3, randomword4, etc... Second File shell script. word=\$(cat hangman_words | cut -d" " -f1) letters=\$(echo \$word | wc -c) letters=\$(( \$letters - 1 )) echo \$letters echo \$word The script...

## Retrieving random numbers out of a text file

Hi one and all, I'm working on a Bash script that is designed to calculate how much IP traffic has passed through a port to determine traffic volume over a given amount of time. I've currently been able to use the netstat -s command coupled with grep to write to a file the total packets...

## \$RANDOM does not work inside a shell script

Hi folks I'm coding on Ubuntu 9.04 standard shell. I'm writing a script that needs to generate a random number at some point of its execution. When I do echo \$RANDOMas a command inside shell, I clearly get some randomly generated number However when I do i=`\$RANDOM` echo \$ior even...

## Shell script that runs a random shell script

Hi, im trying to make a shell script that basically runs a random shell script form a list of shell scripts i specify. Im not very good at writing shell scripts, and am new to linux. Thanks in advance :)

## copying random Jpg files to different folder

Hi, I have 200 pictures in a folder and I would like move 10 random pictures every week to given folder automatically. I have this server on 1and1.com. So I tried the following using Bash script for manual copy and paste for testing #!/bin/bash mapfile -t -n 3 files < <(find...

## Randomize letters

Hi, Is there a tool somewhat parallel to rev, but which randomizes instead of reverses? I've tried rl, but I can only get it to randomize words. I was hoping for something like this echo "hello" | ran leolh less simpler solutions are also welcome. Sorry if the question is...

## Get 20% of lines in File randomly

Hello, This is my code: nb_lignes=`wc -l \$1 | cut -d " " -f1` for i in \$(seq \$nb_lignes) do m=`head \$1 -n \$i | tail -1` //command done Please how can i change it to get Get 20% of lines in File randomly to apply "command" on each line ? 20% or 40% or 60 % (it's a parameter) Thank you.

## Generate random numbers in script

i want to generate a random number through a script, and even if anyone reads the script, they wont be able to figure out what the random number is. only the person who setup the script would know it. something like this could work: random the full thread is here: ...

## Randomly selecting sequences and generating specific output files

I have two files containing hundreds of different sequences with the same Identifiers (ID-001, ID-002, etc.,), something like this: Infile1: ID-001 ATGGGAGCGGGGGCGTCTGCCTTGAGGGGAGAGAAGCTAGATACA ID-002 ATGGGAGCGGGGGCGTCTGTTTTGAGGGGAGAGAAGCTAGATACA ID-003...

## 11. Shell Programming and Scripting

Hi, I've been attempting to create a script that downloads web pages at random intervals to mimic typical user usage. However I'm struggling to link \$url to the URL list and thus wget complains of a missing URL. Any ideas? Thanks #!/bin/sh #URL List url1="http://www.bbc.co.uk"...

## UNIX script for making random numbers without repetition

Hello, I have a column which have 7200 numbers and I am deciding to pick up 1440 numbers randomly without any reputation? Could any one let me know which script in unix will be work for my case? Regards Sajjad

## Help with appending random sequence to huge CDR file

Hi, I am in a terrible emergency. I have multiple cdr files with line count >6000. I need to append |0| | | | | | | |random| to end of each line. The random number should never repeat. Please help with a shell script to process all cdr's in a directory with above requirement.

## True random numbers in Sol10

Hi everyone I just got my hands on a T5120 running Sol10. As far as I've read, the T2 chip has a built-in hardware number generator. My question is: how can I access it to get random numbers in either C or Fortran? I'm using Sun Studio 12.4. I am currently trying to write an...

## Random letters

Hi there, first of all this is not homework...this is a new type of exercise for practicing vocabulary with my students. I have a file consisting of two columns, separated by a tab, each line consisting of a word and its definition, separated by a line break. What i need is to replace a...