Sponsored Content
Full Discussion: True random numbers in Sol10
Operating Systems Solaris True random numbers in Sol10 Post 302978150 by drl on Tuesday 26th of July 2016 05:17:42 PM
Old 07-26-2016
Hi, jlliagre.
Quote:
Originally Posted by jlliagre
@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.
Code:
Sources of true random sequences                                                
        0) AVOID /dev/random /dev/urandom:

        The kernel random-number generator is designed to produce
        a small amount of high-quality seed material to seed a
        cryptographic pseudo- random number generator (CPRNG). It
        is designed for security, not speed, and is poorly suited
        to generating large amounts of random data. Users should be
        very economical in the amount of seed material that they
        read from /dev/urandom (and /dev/random); unnecessarily
        reading large quantities of data from this device will have
        a negative impact on other users of the device.
        -- excerpt from man urandom (linux)

        Applications retrieve random bytes by reading /dev/random
        or /dev/uran- dom. 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) does not increase
        the speed at which random numbers can be read.
        -- excerpt from man urandom (Solaris)

        1) http://www.fourmilab.ch/hotbits/

        2) http://random.irb.hr/index.php

        3) https://www.random.org/

        4) perl module: 
           Net::Random - get random data from online sources
           Sample output, 5 integers (min, max vary):
            From fourmilab.ch   : 600 1785 384 1466 1212
            From qrng.anu.edu.au: 2498 2234 2071 2573 2868
            From random.org     : 7014 5940 5911 6289 3246

Best wishes ... cheers, drl
 

9 More Discussions You Might Find Interesting

1. UNIX for Dummies Questions & Answers

Random numbers without repetition

Is anyone know some scripts to generate random number without repetition using bash; for example generate 10 different random numbers. Thanks (8 Replies)
Discussion started by: asal_email
8 Replies

2. Programming

How to set constrain on random numbers in c

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)
Discussion started by: ahjiefreak
6 Replies

3. Shell Programming and Scripting

Random numbers from 0 to 1000

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)
Discussion started by: wakhan
2 Replies

4. Shell Programming and Scripting

Random Numbers - Perl

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)
Discussion started by: repinementer
3 Replies

5. Shell Programming and Scripting

Generating random numbers

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)
Discussion started by: phil_heath
9 Replies

6. Programming

Random numbers in parent/child?

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)
Discussion started by: xyzt
2 Replies

7. Shell Programming and Scripting

Random float numbers in BASH

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)
Discussion started by: pharaoh
3 Replies

8. Programming

How to fill a memory with random numbers in C

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)
Discussion started by: vdhingra123
3 Replies

9. Homework & Coursework Questions

Random numbers

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
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. SEE ALSO
drand48(3C), random(3M), thread_safety(5), random(7). STANDARDS CONFORMANCE
rand(3C)
All times are GMT -4. The time now is 07:22 PM.
Unix & Linux Forums Content Copyright 1993-2022. All Rights Reserved.
Privacy Policy