07-03-2011
Methods for Random Number Tracking
what types of methods and algorithms are used to track random number generators? I'm working on computer security, and I want to know all the different ways to track random number generators so I know what to counter
10 More Discussions You Might Find Interesting
1. Shell Programming and Scripting
Having a bit of trouble trying to sort this one out so any advice is appreciated.
I have several scripts running in cron monitoring different events on different servers. These scripts log information events and critical events to a central log file.
I wanted to add an event number to every... (4 Replies)
Discussion started by: frustrated1
4 Replies
2. Programming
Hi...How can I generate random numbers between a given range ...preferably between 1 and 100...in UNIX C programming...?
I tried out functions like rand(),drand48() etc but didnt get satisfactory results...
Thanks a lot in advance.......... (1 Reply)
Discussion started by: tej.buch
1 Replies
3. Shell Programming and Scripting
HI
please help me in solving this issue.
I have a shell script which consists of ten statemnts ( i mean 10 executable statments)...........and if i run that script the 10 statmenst will execute continously ............
But now my probelm is i have to write another script --> to... (0 Replies)
Discussion started by: lalitka
0 Replies
4. Shell Programming and Scripting
How do I create a random number between 1 and 10 in kornshell? (2 Replies)
Discussion started by: dangral
2 Replies
5. Programming
Im new to C, and Im having a hard time getting a random number.
In bash, I would do something similar to the following to get a random number;
#!/bin/bash
seed1=$RANDOM
seed2=$RANDOM
seed3=$RANDOM
SEED=`expr $seed1 * $seed2 / $seed3`
echo ${SEED%.*}
Now, in online examples... (4 Replies)
Discussion started by: trey85stang
4 Replies
6. Programming
I need to generate and reuse a 5 digit random number every time my program is executed. But the following generates random numbers every time the function is called.
#include <stdio.h>
#include <stdlib.h>
#include <sys/types.h>
#include <sys/stat.h>
#include <string.h>
#include <time.h>
... (12 Replies)
Discussion started by: limmer
12 Replies
7. Programming
I saw this formula to generate random number between two specified values in shell script.the following.
$(((RANDOM%(max-min+divisibleBy))/divisibleBy*divisibleBy+min))
Give a example in book.
Generate random number between 6 and 30.like this.
$(((RANDOM%30/3+1)*3))
But I have a... (1 Reply)
Discussion started by: luoluo
1 Replies
8. Shell Programming and Scripting
Hello folks,
i have number for example 10 and i want to divide into 4 random pieces that may be (6+2+1+1). How can i do this via script i have random number 234951 and i want to divide into 31 pieces. (6 Replies)
Discussion started by: learnbash
6 Replies
9. Shell Programming and Scripting
Hi,
I'm trying to create a script that will print random numbers with length of three.
Below is the expected out.
928-377-899
942-458-310
951-948-511
962-681-415
995-161-708
997-997-209
thanks (4 Replies)
Discussion started by: reignangel2003
4 Replies
10. Programming
How can I choose randomly the row numbers of my file in awk? (4 Replies)
Discussion started by: Homa
4 Replies
RANDOM(3) Library Functions Manual RANDOM(3)
NAME
random, srandom, initstate, setstate - better random number generator; routines for changing generators
SYNOPSIS
long random()
srandom(seed)
int seed;
char *initstate(seed, state, n)
unsigned seed;
char *state;
int n;
char *setstate(state)
char *state;
DESCRIPTION
Random uses a non-linear additive feedback random number generator employing a default table of size 31 long integers to return successive
pseudo-random numbers in the range from 0 to (2**31)-1. The period of this random number generator is very large, approximately
16*((2**31)-1).
Random/srandom have (almost) the same calling sequence and initialization properties as rand/srand. The difference is that rand(3) pro-
duces a much less random sequence -- in fact, the low dozen bits generated by rand go through a cyclic pattern. All the bits generated by
random are usable. For example, ``random()&01'' will produce a random binary value.
Unlike srand, srandom does not return the old seed; the reason for this is that the amount of state information used is much more than a
single word. (Two other routines are provided to deal with restarting/changing random number generators). Like rand(3), however, random
will by default produce a sequence of numbers that can be duplicated by calling srandom with 1 as the seed.
The initstate routine allows a state array, passed in as an argument, to be initialized for future use. The size of the state array (in
bytes) is used by initstate to decide how sophisticated a random number generator it should use -- the more state, the better the random
numbers will be. (Current "optimal" values for the amount of state information are 8, 32, 64, 128, and 256 bytes; other amounts will be
rounded down to the nearest known amount. Using less than 8 bytes will cause an error). The seed for the initialization (which specifies
a starting point for the random number sequence, and provides for restarting at the same point) is also an argument. Initstate returns a
pointer to the previous state information array.
Once a state has been initialized, the setstate routine provides for rapid switching between states. Setstate returns a pointer to the
previous state array; its argument state array is used for further random number generation until the next call to initstate or setstate.
Once a state array has been initialized, it may be restarted at a different point either by calling initstate (with the desired seed, the
state array, and its size) or by calling both setstate (with the state array) and srandom (with the desired seed). The advantage of call-
ing both setstate and srandom is that the size of the state array does not have to be remembered after it is initialized.
With 256 bytes of state information, the period of the random number generator is greater than 2**69 which should be sufficient for most
purposes.
AUTHOR
Earl T. Cohen
DIAGNOSTICS
If initstate is called with less than 8 bytes of state information, or if setstate detects that the state information has been garbled,
error messages are printed on the standard error output.
SEE ALSO
rand(3)
BUGS
About 2/3 the speed of rand(3C).
4.2 Berkeley Distribution September 29, 1985 RANDOM(3)