10-01-2012
random number
How can I choose randomly the row numbers of my file in awk?
10 More Discussions You Might Find Interesting
1. Programming
How to generate a random integer with specific range(for example, from 1 to 1000)?
Also, how to convert a floating point number into a integer? (2 Replies)
Discussion started by: MacMonster
2 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. Shell Programming and Scripting
Hi there I am trying to generate a random number between 40 and 70 using the shell here is my code so far and it keeps going above 70. all help much appreciated!
comp=$(( RANDOM%70+40 ))
echo $comp (4 Replies)
Discussion started by: faintingquiche
4 Replies
LEARN ABOUT DEBIAN
numrandom
NUMRANDOM(1) User Contributed Perl Documentation NUMRANDOM(1)
NAME
numrandom - Print out a random number.
SYNOPSIS
numrandom [-dhV] /[expression]/
DESCRIPTION
numrandom will print out a random number determined by the expression that you give. The syntax and program is nearly identical to the
numrange program, except that numrandom picks a number at random from the range expression. If no expression is specified, numrandom will
print out a random integer between 1 and 100. Ranges are inclusive.
OPTIONS
-h Help: You're looking at it.
-V Increase verbosity.
-d Debug mode. For developers
EXAMPLES
Random number from 1 to 10.
$ numrandom /1..10/
7
From 1 to 10 or from 15 to 20.
$ numrandom /1..10,15..20/
16
An even number from 0 to 10
$ numrandom /0..10i2/
4
An odd number. Notice the starting number in the range.
$ numrandom /1..10i2/
9
A factor of 3 between 99 and 120.
$ numrandom /99..120i3/
111
A decimal number.
$ numrandom /1.1..2.5i0.1/
1.8
A negative random number.
$ numrandom /0.0..-2.0i0.3/
-0.8
BUGS
numrandom is slow when dealing with large ranges to randomly find a number from. This is because it creates a list of all potential
numbers before picking one. So it can be memory intensive for large ranges.
SEE ALSO
numaverage(1), numbound(1), numinterval(1), numnormalize(1), numgrep(1), numprocess(1), numsum(1), numrange(1), numround(1)
COPYRIGHT
numrandom is part of the num-utils package, which is copyrighted by Suso Banderas and released under the GPL license. Please read the
COPYING and LICENSE files that came with the num-utils package
Developers can read the GOALS file and contact me about providing
submitions or help for the project.
MORE INFO
More info on numrandom can be found at:
http://suso.suso.org/programs/num-utils/
perl v5.10.1 2009-10-31 NUMRANDOM(1)