03-25-2014
problem with adding the two random numbers
i dont know what is the proper code to use
9 More Discussions You Might Find Interesting
1. UNIX for Dummies Questions & Answers
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
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
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
Hi
I have the below code
MAXCOUNT=10
count=1
echo
echo "$MAXCOUNT random numbers:"
echo "-----------------"
while # Generate 10 ($MAXCOUNT) random integers.
do
number=$ + 1 ]
"echo $number"
let "count += 1" # Increment count.
done
But aftre executing this
... (8 Replies)
Discussion started by: lalitka
8 Replies
5. Shell Programming and Scripting
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
6. Shell Programming and Scripting
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
7. Shell Programming and Scripting
Hi Can someone help me with this one?
I have string..
(PROC_PROC_ID == 12183) <--PID is dynamic
and i want to replace the PID number with whatever PID from
/opt/hpws/apache32_2/logs/httpd.pid file.
i'm having problem since the PID on the string is dynamic. It may be 2-5 digits or more.
... (5 Replies)
Discussion started by: ryandegreat25
5 Replies
8. Shell Programming and Scripting
I have a file contains thousands of lines. I want to insert n random numbers into each line at
specific position. Like this:
0 22……
1 33……
……
……
I want to insert 3 random numbers from position 2 to 4 into each line.
0 325 22……
1 685 33……
……
……
Please use CODE tags when... (8 Replies)
Discussion started by: hhdzhu
8 Replies
9. Solaris
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... (13 Replies)
Discussion started by: toguro123
13 Replies
LEARN ABOUT DEBIAN
data::random::wordlist
Data::Random::WordList(3pm) User Contributed Perl Documentation Data::Random::WordList(3pm)
NAME
Data::Random::WordList - Perl module to get random words from a word list
SYNOPSIS
use Data::Random::WordList;
my $wl = new Data::Random::WordList( wordlist => '/usr/share/dict/words' );
my @rand_words = $wl->get_words(10);
$wl->close();
DESCRIPTION
Data::Random::WordList is a module that manages a file containing a list of words.
The module expects each line of the word list file to contain only one word. It could thus be easily used to select random lines from a
file, but for coherency's sake, I'll keep referring to each line as a word.
The module uses a persistent filehandle so that there isn't a lot of overhead every time you want to fetch a list of random words.
However, it's much more efficient to grab multiple words at a time than it is to fetch one word at a time multiple times.
The module also refrains from reading the whole file into memory, so it can be safer to use with larger files.
METHODS
new()
Returns a reference to a new Data::Random::WordList object. Use the "wordlist" param to initialize the object:
o wordlist - the path to the wordlist file. If a path isn't supplied, the wordlist distributed with this module is used.
get_words([NUM])
NUM contains the number of words you want from the wordlist. NUM defaults to 1 if it's not specified. get_words() dies if NUM is greater
than the number of words in the wordlist. This function returns an array or an array reference depending on the context in which it's
called.
close()
Closes the filehandle associated with the word list. It's good practice to do this every time you're done with the word list.
VERSION
0.07
AUTHOR
Originally written by: Adekunle Olonoh
Currently maintained by: Buddy Burden (barefoot@cpan.org), starting with version 0.06
COPYRIGHT
Copyright (c) 2000-2011 Adekunle Olonoh. All rights reserved. This program is free software; you can redistribute it and/or modify it
under the same terms as Perl itself.
SEE ALSO
Data::Random
perl v5.14.2 2012-06-04 Data::Random::WordList(3pm)