Generating Random Numbers

Use this forum to post Vensim related questions.
Post Reply
dtb717
Junior Member
Posts: 2
Joined: Wed Mar 09, 2016 9:28 pm
Vensim version: PLE+

Generating Random Numbers

Post by dtb717 »

How do I code a simple random number generator?

When I run the sample code for various random number distributions here:
https://www.vensim.com/documentation/in ... random.htm

They all of produce the same "random" output with every simulation.
Is there a way to have these functions produce a different "random" output when I re-run the simulation?

Thanks!
Administrator
Super Administrator
Posts: 4573
Joined: Wed Mar 05, 2003 3:10 am

Re: Generating Random Numbers

Post by Administrator »

Advice to posters seeking help (it really helps us to help you)
http://www.ventanasystems.co.uk/forum/v ... f=2&t=4391

Units are important!
http://www.bbc.co.uk/news/magazine-27509559
dtb717
Junior Member
Posts: 2
Joined: Wed Mar 09, 2016 9:28 pm
Vensim version: PLE+

Re: Generating Random Numbers

Post by dtb717 »

Okay, thanks, that explains the "seed" functionality.
Is there a way that I can set the seed value to be a different random number every time I run the simulation?
Administrator
Super Administrator
Posts: 4573
Joined: Wed Mar 05, 2003 3:10 am

Re: Generating Random Numbers

Post by Administrator »

Advice to posters seeking help (it really helps us to help you)
http://www.ventanasystems.co.uk/forum/v ... f=2&t=4391

Units are important!
http://www.bbc.co.uk/news/magazine-27509559
tomfid
Administrator
Posts: 3804
Joined: Wed May 24, 2006 4:54 am

Re: Generating Random Numbers

Post by tomfid »

Hossein
Member
Posts: 48
Joined: Thu Sep 15, 2016 7:50 am
Vensim version: DSS

Re: Generating Random Numbers

Post by Hossein »

Dear Tom,

You mentioned that it is possible to do a sensitivity analysis on Seed by using a VECTOR function. However, in the "Sensitivity Simulation Setup" box in the software, there is also another "Noise Seed", which is by difault "1234"!!! Are these Seeds different? if not, then which one is the base for sensitivity? "Noise Seed" or "Seed = VECTOR(Min, Max, Increment)" ?
tomfid
Administrator
Posts: 3804
Joined: Wed May 24, 2006 4:54 am

Re: Generating Random Numbers

Post by tomfid »

They are different.

The NOISE SEED affects the time varying random streams in the model variables, IF the seed parameter in the function call is 0, like RANDOM UNIFORM(0,1,0). If you use RANDOM UNIFORM(0,1,x) you have to vary x explicitly.

The seed in the sensitivity control file governs the generation of the random sample. "1234" has no particular significance - it could be any integer between 1 and about 2 billion. Referring to "seed" in the control file won't work (unless you also have a constant with that name).
Post Reply