Visit Our UNIX and Linux User Community

Top Forums Shell Programming and Scripting Random numbers from 0 to 1000 Post 302214916 by wakhan on Tuesday 15th of July 2008 07:28:12 AM
Old 07-15-2008
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!!!!!!

Waqas Ahmed
Test Your Knowledge in Computers #599
Difficulty: Medium
For modern C programming, defining functions is a two step process. First, you declare a function and its signature using a prototype. Then you define the function by providing a function body that defines what the function does.
True or False?

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. 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

3. 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

4. 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

5. Shell Programming and Scripting

Replace a random string of numbers

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/ 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

6. Shell Programming and Scripting

[Solved] Help with random pick 1000 number from range 1 to 150000

Hi, Do anybody knows how to use awk or any command to random print out 1000 number which start from range 1 to 150000? I know that "rand" in awk can do similar random selection. But I have no idea how to write a code that can random pick 1000 number from range 1 to 150000 :confused: ... (1 Reply)
Discussion started by: perl_beginner
1 Replies

7. 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

8. Shell Programming and Scripting

Creating a sequence of numbers in a line for 1000 files

Hi, I try to explain my problem , I have a file like this: aasdsaffsc23 scdsfsddvf46567 mionome0001.pdb asdsdvcxvds dsfdvcvc2324w What I need to do is to create 1000 files in which myname line listing a sequence of numbers from 0001 to 1000. So I want to have : nomefile0001.txt that must... (10 Replies)
Discussion started by: danyz84
10 Replies

9. Shell Programming and Scripting

How to insert random numbers into each line?

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
Statistics::Test::RandomWalk(3pm)			User Contributed Perl Documentation			 Statistics::Test::RandomWalk(3pm)

Statistics::Test::RandomWalk - Random Walk test for random numbers SYNOPSIS
use Statistics::Test::RandomWalk; my $tester = Statistics::Test::RandomWalk->new(); $tester->set_data( [map {rand()} 1..1000000] ); my $no_bins = 10; my ($quant, $got, $expected) = $tester->test($no_bins); print $tester->data_to_report($quant, $got, $expected); DESCRIPTION
This module implements a Random Walk test of a random number generator as outlined in Blobel et al (Refer to the SEE ALSO section). Basically, it tests that the numbers "[0,1]" generated by a random number generator are distributed evenly. It divides "[0,1]" into "n" evenly sized bins and calculates the number of expected and actual random numbers in the bin. (In fact, this counts the cumulated numbers, but that works the same.) METHODS
new Creates a new random number tester. set_rescale_factor The default range of the random numbers [0, 1) can be rescaled by a constant factor. This method is the setter for that factor. rescale_factor Returns the current rescaling factor. set_data Sets the random numbers to operate on. First argument must be either an array reference to an array of random numbers or a code reference. If the first argument is a code reference, the second argument must be an integer "n". The code reference is called "n"-times and its return values are used as random numbers. The code reference semantics are particularly useful if you do not want to store all random numbers in memory at the same time. You can write a subroutine that, for example, generates and returns batches of 100 random numbers so no more than 101 of these numbers will be in memory at the same time. Note that if you return 100 numbers at once and pass in "n=50", you will have a sequence of 5000 random numbers. test Runs the Random Walk test on the data that was previously set using "set_data". First argument must be the number of bins. Returns three array references. First is an array of quantiles. If the number of bins was ten, this (and all other returned arrays) will hold ten items. Second are the determined numbers of random numbers below the quantiles. Third are the expected counts. data_to_report From the data returned by the "test()" method, this method creates a textual report and returns it as a string. Do not forget to pass in the data that was returned by "test()" or use the "test_report()" method directly if you do not use the data otherwise. SUBROUTINES
n_over_k Computes "n" over "k". Uses Perl's big number support and returns a Math::BigFloat object. This sub is memoized. SEE ALSO
Math::BigFloat, Memoize, Params::Util Random number generators: Math::Random::MT, Math::Random, Math::Random::OO, Math::TrulyRandom, "/dev/random" where available Statistics::Test::Sequence The algorithm was taken from: (German) Blobel, V., and Lohrmann, E. Statistische und numerische Methoden der Datenanalyse. Stuttgart, Leipzig: Teubner, 1998 AUTHOR
Copyright (C) 2007-2010 by Steffen Mueller This library is free software; you can redistribute it and/or modify it under the same terms as Perl itself, either Perl version 5.6 or, at your option, any later version of Perl 5 you may have available. perl v5.10.1 2011-01-01 Statistics::Test::RandomWalk(3pm)

Featured Tech Videos

All times are GMT -4. The time now is 02:18 AM.
Unix & Linux Forums Content Copyright 1993-2021. All Rights Reserved.
Privacy Policy