@drl: You should avoid using Linux documentation with Solaris. It might not be relevant which is especially the case in this thread. ...
OK, thanks for the comment. I'll add an excerpt from Solaris. It looks quite similar to me, but it might be more on point for Solaris users. I'm trying emphasize that /dev/random & /dev/urandom are probably not good sources for true random sequences, and that the net resources mentioned are such sources, and that they would (generally) be portable.
Best wishes ... cheers, drl
Is anyone know some scripts to generate random number without repetition using bash; for example generate 10 different random numbers.
Thanks (8 Replies)
Hi,
I am currently trying to generate multiple random numbers in C for different variable:-
die1=1+(rand()%5);
die2=1+(rand()%5);
die3=1+(rand()%5);
die4=1+(rand()%5);
But I need to contrain the total of die1, die2,die3 and die4 to be 5 as well. If i insert die1+die2+die3+die4=5, i do... (6 Replies)
Hello All,
I want to make a simple script which generate random number from 0 to 1000.
and simply display it.
Plz HELP!!!!!!
Regards,
Waqas Ahmed (2 Replies)
Hi Guys I have a script to find Ranomd numbers. But I want to make the file to produce more random. Could u guys help me plz.
In this Script I have the code that generates random in for loop and the range I have specified in my %chromlength
input and out put will be like this
chrno start end... (3 Replies)
Hi,
I am having trouble with generating random numbers. can this be done with awk?
So I have a file that looks like this:
23 30
24 40
26 34
So column1 is start and column2 is end. I want to generate 3 random #'s between start and stop:
So the output will look like this:
... (9 Replies)
Hi
I'm trying to generate random numbers both in parent process and the child process. But I get the same random number in both processes. Why doesn't it generate different numbers altough I seed random number generator?
Here's my code:
#include <stdio.h>
#include <unistd.h>
#include... (2 Replies)
Hi people :)
I'm learning shell scripting using bash and I want to generate 4 floating point number with 5 decimal places and write them to a file and a variable. I've done all this except the $RAMDOM enviroment variable does not generate a float number but a integrer.
I hope you could... (3 Replies)
Hi,
I have a parametrized memory mem.
I want to fill this memory with random numbers with respect to the data_width.
can anyone help me on this.. (3 Replies)
Use and complete the template provided. The entire template must be completed. If you don't, your post may be deleted!
Write a shell script that will take the sum of two random number?
Ex: Random n1 +Random n2 = result
i tries to write it but i had some dufficulties
... (3 Replies)
Discussion started by: renegade755
3 Replies
LEARN ABOUT OPENSOLARIS
random
random(7D) Devices random(7D)NAME
random, urandom - Strong random number generator device
SYNOPSIS
/dev/random
/dev/urandom
DESCRIPTION
The /dev/random and /dev/urandom files are special files that are a source for random bytes generated by the kernel random number generator
device. The /dev/random and /dev/urandom files are suitable for applications requiring high quality random numbers for cryptographic pur-
poses.
The generator device produces random numbers from data and devices available to the kernel and estimates the amount of randomness (or
"entropy") collected from these sources. The entropy level determines the amount of high quality random numbers that are produced at a
given time.
Applications retrieve random bytes by reading /dev/random or /dev/urandom. The /dev/random interface returns random bytes only when suffi-
cient amount of entropy has been collected. If there is no entropy to produce the requested number of bytes, /dev/random blocks until more
entropy can be obtained. Non-blocking I/O mode can be used to disable the blocking behavior. The /dev/random interface also supports
poll(2). Note that using poll(2) will not increase the speed at which random numbers can be read.
Bytes retrieved from /dev/random provide the highest quality random numbers produced by the generator, and can be used to generate long
term keys and other high value keying material.
The /dev/urandom interface returns bytes regardless of the amount of entropy available. It does not block on a read request due to lack of
entropy. While bytes produced by the /dev/urandom interface are of lower quality than bytes produced by /dev/random, they are nonetheless
suitable for less demanding and shorter term cryptographic uses such as short term session keys, paddings, and challenge strings.
Data can be written to /dev/random and /dev/urandom. Data written to either special file is added to the generator's internal state. Data
that is difficult to predict by other users may contribute randomness to the generator state and help improve the quality of future gener-
ated random numbers.
/dev/random collects entropy from providers that are registered with the kernel-level cryptographic framework and implement random number
generation routines. The cryptoadm(1M) utility allows an administrator to configure which providers will be used with /dev/random.
ERRORS
EAGAIN O_NDELAY or O_NONBLOCK was set and no random bytes are available for reading from /dev/random.
EINTR A signal was caught while reading and no data was transferred.
ENOXIO open(2) request failed on /dev/random because no entropy provider is available.
FILES
/dev/random
/dev/urandom
ATTRIBUTES
See attributes(5) for descriptions of the following attributes:
+-----------------------------+-----------------------------+
| ATTRIBUTE TYPE | ATTRIBUTE VALUE |
+-----------------------------+-----------------------------+
|Availability | SUNWcsr |
|Interface Stability |Evolving |
+-----------------------------+-----------------------------+
SEE ALSO cryptoadm(1M), open(2), poll(2), attributes(5)NOTES
/dev/random can be configured to use only the hardware-based providers registered with the kernel-level cryptographic framework by dis-
abling the software-based provider using cryptoadm(1M). You can also use cryptoadm(1M) to obtain the name of the software-based provider.
Because no entropy is available, disabling all randomness providers causes read(2) and poll(2) on /dev/random to block indefinitely and
results in a warning message being logged and displayed on the system console. However, read(2) and poll(2) on /dev/urandom continue to
work in this case.
An implementation of the /dev/random and /dev/urandom kernel-based random number generator first appeared in Linux 1.3.30.
A /dev/random interface for Solaris first appeared as part of the CryptoRand implementation.
SunOS 5.11 1 Sep 2008 random(7D)