LinuxQuestions.org
Latest LQ Deal: Latest LQ Deals
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Newbie
User Name
Password
Linux - Newbie This Linux forum is for members that are new to Linux.
Just starting out and have a question? If it is not in the man pages or the how-to's this is the place!

Notices


Reply
  Search this Thread
Old 05-21-2017, 10:49 AM   #1
cai
LQ Newbie
 
Registered: Dec 2016
Posts: 21

Rep: Reputation: Disabled
What general pseudo random sequence generator do in ns2 (tcl script)?


I've seen a sample tcl script for ns2 in https://github.com/hbatmit/ns2.35/bl...l/ex/aomdv.tcl. At line 50, I saw this line :

set val(seed) 1 ;# general pseudo-random sequence generator

and at line 116 :

# General pseudo-random sequence generator
set genSeed [new RNG]
$genSeed seed $val(seed)
set randomSeed [new RandomVariable/Uniform]
$randomSeed use-rng $genSeed
$randomSeed set min_ 1.0
$randomSeed set max_ 100.0

Can anyone tell me what is the effect of pseudo random squence generator (PRNG) in ns2? TQ in advance
 
Old 05-21-2017, 12:26 PM   #2
AwesomeMachine
LQ Guru
 
Registered: Jan 2005
Location: USA and Italy
Distribution: Debian testing/sid; OpenSuSE; Fedora; Mint
Posts: 5,513

Rep: Reputation: 1010Reputation: 1010Reputation: 1010Reputation: 1010Reputation: 1010Reputation: 1010Reputation: 1010Reputation: 1010
It's usually for encryption.
 
Old 05-21-2017, 02:47 PM   #3
knudfl
LQ 5k Club
 
Registered: Jan 2008
Location: Copenhagen DK
Distribution: PCLinuxOS2021 CentOS7.9 + 50+ other Linux OS, for test only.
Posts: 17,430

Rep: Reputation: 3623Reputation: 3623Reputation: 3623Reputation: 3623Reputation: 3623Reputation: 3623Reputation: 3623Reputation: 3623Reputation: 3623Reputation: 3623Reputation: 3623
Quote:
What general pseudo random sequence generator do in ns2 (tcl script)?
Used for `seedī only, I think.

Random : set val(seed) 0 http://www.isi.edu/nsnam/ns/doc/node268.html

Other INFO: Google, ns2 seed https://www.google.com/webhp?hl=all&...=en&q=ns2+seed
. http://mailman.isi.edu/pipermail/ns-...il/055441.html
. https://books.google.dk/books?id=_Vk...20seed&f=false
. http://t-issariyakul.blogspot.dk/200...vs-random.html
... etc. etc. ~100,000 hits.

-
 
Old 05-21-2017, 08:47 PM   #4
sundialsvcs
LQ Guru
 
Registered: Feb 2004
Location: SE Tennessee, USA
Distribution: Gentoo, LFS
Posts: 9,238
Blog Entries: 4

Rep: Reputation: 3263Reputation: 3263Reputation: 3263Reputation: 3263Reputation: 3263Reputation: 3263Reputation: 3263Reputation: 3263Reputation: 3263Reputation: 3263Reputation: 3263
Here's a generalized description of the idea ... pretty much applicable to any language (including this one).

A "PRNG = Pseudo-Random Number Generator" is an algorithm that produces a "random" series of values – that is to say, "very unpredictable." (For statistics work, "an acceptably un-biased source of numbers for use in drawing samples from a population, and with certain favorable statistical characteristics.") The term, "pseudo," refers to the fact that the actual sequence, necessarily, "isn't 'random' at all."

Each new value that is produced is mathematically based upon a so-called seed, and each iteration calculates a new seed.
  • A fundamental property of these algorithms – very useful and important for statistical work – is that, "given an identical starting seed, the PRNG will always produce the same 'random' sequence." So, if you capture the seed-value before starting to produce a 'random' sequence, you can always re-create that exact same sequence in the future. (Very handy if the sequence is to be very long ...)

When a typical program starts, it must (somehow) produce a new "initial seed" for its PRNG. It wants this value to be "fairly unpredictable." There are various ways to do this – the exact value of the computer's clock at this precise instant, or some other source of [pseudo-]randomness such as /dev/urandom. Most importantly, if the program is run twice in a row, its "initial seed" value each time should (by default ...) be different, and "unpredictable." I surmise that this is what the first few statements that you have quoted are actually doing.

(And yet, if you do want to know what the current seed-value is ... and/or to set the seed to a particular value ... facilities exist to allow you to do that, for the statistical purposes aforementioned.)

There are various ways to use the output of a PRNG. In your program, it appears that it is being set to produce values in the inclusive range from "1.0" to "100.0," and that they are to be "real numbers (vs. integers). This sort of capability is entirely typical. But I admit to being unfamiliar with the particular language that you are referring-to here.

Run-of-the-mill PRNGs are fine for computer games, and they are specifically designed for use in statistics, but they are n-o-t(!) suitable for cryptographic work. An entirely different class of [public ...] algorithms are used for that very-special mathematical purpose.

Anyway – "hope this helps to set the stage."

Last edited by sundialsvcs; 05-21-2017 at 08:57 PM.
 
  


Reply

Tags
ns2, ns2 seed


Thread Tools Search this Thread
Search this Thread:

Advanced Search

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off



Similar Threads
Thread Thread Starter Forum Replies Last Post
How to add more nodes to ns2 tcl script joseph4life Linux - Newbie 0 03-07-2014 05:45 AM
Pseudo Random Generator is not initialized from the (entropy pool) !!!!? LinuxInDepth Red Hat 1 04-29-2012 06:24 PM
NS2.29.3 TCL script compile errors iamusbah Linux - Newbie 1 03-27-2012 04:20 AM
script tcl NS2 MounaRM Linux - Networking 0 01-10-2011 08:49 AM
Attaching an algorithm to tcl script in ns2 raviteja99 Linux - Wireless Networking 2 09-12-2010 07:16 PM

LinuxQuestions.org > Forums > Linux Forums > Linux - Newbie

All times are GMT -5. The time now is 04:13 PM.

Main Menu
Advertisement
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Open Source Consulting | Domain Registration