Does Solaris have a random number generator?


 
Thread Tools Search this Thread
Operating Systems Solaris Does Solaris have a random number generator?
# 1  
Old 04-09-2008
Does Solaris have a random number generator?

I am trying to find a way to generate random numbers within a shell script.
Does Solaris have a utility that will generate random numbers?

Thanks in advance.
B
# 2  
Old 04-09-2008
for sh/ksh/bash
Code:
 print $RANDOM

# 3  
Old 04-09-2008
It really depends on how random you want the data to be, $RANDOM in a tight loop doesn't give great results, reading from /dev/random /dev/urandom will give better results. Perderabo posted a very good random number generator script also.
# 4  
Old 04-10-2008
Thanks for the tips.
The degree of randomness is not critical for me, so the print $RANDOM is fine.
I found Perderabo's script too, but it's probably more than I need at this stage.

Thanks again to all who replied.
B
Login or Register to Ask a Question

Previous Thread | Next Thread

9 More Discussions You Might Find Interesting

1. Shell Programming and Scripting

Random Password generator with 2 digits and 6 characters

I am using the below to random generate a password but I need to have 2 numeric characters and 6 alphabetic chars head /dev/urandom | tr -dc A-Za-z0-9 | head -c 8 ; echo '' 6USUvqRB ------ Post updated at 04:43 PM ------ Any Help folks - Can the output be passed onto a sed command to... (9 Replies)
Discussion started by: infernalhell
9 Replies

2. Shell Programming and Scripting

awk (or) UNIX random RGB colors generator?

Dear UNIX Friends, I was wondering if there is a random RGB color generator or any function in any unix platforms. Please share your ideas. Thanks (2 Replies)
Discussion started by: jacobs.smith
2 Replies

3. UNIX for Dummies Questions & Answers

A crude random byte generator...

There was an upload recently on generating a pseudo-random file when /dev/random does NOT exist. This does not need /dev/random, /dev/urandom or $RANDOM either... (I assume $RANDOM relies on the /dev/random device in some way.) This code uses hexdump just because I like hexdump for ease of... (2 Replies)
Discussion started by: wisecracker
2 Replies

4. Shell Programming and Scripting

[Solved] Number generator

Hello, I want to generate numbers. between "0 to 100000" Thank you very much for your help. Output: 0 25 50 75 100 125 . . 100000 (4 Replies)
Discussion started by: tara123
4 Replies

5. Programming

random number

How can I choose randomly the row numbers of my file in awk? (4 Replies)
Discussion started by: Homa
4 Replies

6. Shell Programming and Scripting

Need specialized random string generator script

Hi, I need a script that will generate a set of random strings in sequence, with the ability to predetermine the length, quantity, and alphabet of individual string, and to use the outputs of earlier strings in the sequence to define the parameters of later strings. For examples, I might want... (5 Replies)
Discussion started by: vajrajames
5 Replies

7. Programming

Random number is not reused

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

8. Shell Programming and Scripting

Random Sentence Generator

Hi, I need to create a table with random sentences. I need lines that are upto 1000 characters in lenght. I need a random sentence generator that will create sentences and output it to a text file. The sentences should be of lenght varying from 1 to 1000. Does anyone know how this can be... (7 Replies)
Discussion started by: kaushys
7 Replies

9. Programming

Random number generation

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
Login or Register to Ask a Question