ATTENTIONThis FlexSim Community Forum is read-only. Please post any new questions, ideas, or discussions to our new community (we call it Answers) at https://answers.flexsim.com/. Our new Question & Answer site brings a modern, mobile-friendly interface and more focus on getting answers quickly. There are a few differences between how our new Q&A community works vs. a classic, threaded-conversation-style forum like the one below, so be sure to read our Answers Best Practices. |
flexsim.com |
#1
|
||||
|
||||
Pseudo Randomness
Each time i run Flexsim, different things happen . . Duh, that's what randomness means!
However, sometimes:
Does anyone know if there is an easy way to do this? Thanks Kenny |
#2
|
||||
|
||||
Flexsim will reset the random streams with the same seed value whenever the model is reset IF you select the "Repeat Random Streams" option under the Statistics menu. If you want to be in control of the seed value, you can explicitly reset a particular stream with a particular seed value of your choosing with the randinit() command.
|
The Following User Says Thank You to Cliff King For This Useful Post: | ||
Kenny Macleod (06-28-2008) |
#4
|
|||
|
|||
I'd recommend using a random seed for initialisation between 1 and 2147483647. You can put the code below on a reset User Event and make sure your User Events folder is at the top of the Tools folder. This will make your replications repeatable should you later wish to run one of them individually.
Code:
int totalstreams=50; //the number of streams you want to initialize int streambase=100; //The starting stream offset - could be 0 too int firstreplication=getnodenum(node("/project/exec/replications/Current",maintree())); int replication=0; if (firstreplication==0) replication=1; //reset button has probably been hit else replication=getnodenum(node("/project/exec/replications/CurrentRunOfScenario",maintree())); //replication=30; // un-comment this line to initialise the streams for a particular replication randinit(0,replication); //we'll user stream zero to initialize the other streams' seeds for (int n=1;n<=totalstreams;n++){ randinit(streambase+n,duniform(1,2147483647,0)); } Last edited by Kris Geisberger; 11-18-2008 at 09:33 AM. Reason: changed User Commands to User Events for Jason |
The Following 2 Users Say Thank You to Jason Lightfoot For This Useful Post: | ||
Kenny Macleod (06-28-2008) |
#5
|
||||
|
||||
Thanks Jason
Thanks Jason
I'm not so strong on C++ yet but that makes sense. I'll definately use this code once i'm up to speed. Cheers Kenny ps - Say Hi to Mike Ellarby, it was him that put me onto Flexsim in the first place - at OR Society SW08. I liked it so much that I sought out the Australian/NZ disrtibutor role. |