In addition to the thread of @David Besson Decide activity by percentage bug? how can we set a range of values without the limit values itself like ]0..100[ or 0 < x < 100 inside the parameters of a uniform distribution?

Comment

Best Answer

**Answer** by phil.bobo ·

Although the uniform() command documentation claims to be inclusive, if you actually test it, it isn't. It might theoretically be inclusive, but there are theoretically an infinite number of values between any two decimal values so the probably of actually being the extremes is infinitesimally small (roughly 1 in 2^53 for a double-precision value) such that in actual practice, I don't think it ever returns the extremes.

So you can use use the uniform() distribution to get an exclusive distribution of floating point values, as the example code below shows:

int extremes = 0; for (int i = 1; i <= 10000000; i++) { double num = uniform(0,100); if (num == 0 || num == 100) { extremes++; // this code will never get hit } } return extremes; // this will always return 0

If you are using duniform(), then you can add 1 to the beginning or subtract 1 from the end to make it exclusive.

The random values uniform() gives back are unlikely to ever actually equal any specific value in the range, including the extremes, unless that value was explicitly obtained using that pseudo-random number generation and then repeated.

**Answer** by jeff.nordgren ·

Jorge,

Have you tried using Global Macros as substitutes for the actual limit values themselves?

© 1993- FlexSim Software Products, Inc. All Rights Reserved.

FlexSim is a fully 3D simulation software environment. FlexSim can be used to simulate any process in any industry.

FlexSim®, FlexSim Healthcare™, Problem Solved.®, the FlexSim logo, the FlexSim X-mark, and the FlexSim Healthcare logo with stylized Caduceus mark are trademarks of FlexSim Software Products, Inc. All rights reserved.

- site links
- www.flexsim.com
- contact us
- blog
- privacy policy
- archived forum

- Anonymous
- Sign in
- Create
- Ask a question
- Post an idea
- Create an article
- Spaces
- Software & Simulation Questions
- Accounts & Licensing
- FlexSim
- FlexSim Healthcare
- Explore
- Topics
- Questions
- Ideas
- Articles
- Users
- Badges