Jump to content
Sign in to follow this  
no23rman

Create Random "Even/Odd" Number within Range

Recommended Posts

How do you generate even/odd random numbers?

ex) Generate "even" random number from (2-10)

resulting in random value from (2,4,6,8,or 10)

Has anyone done this before?

Thanks

Edited by Guest

Share this post


Link to post
Share on other sites

Try:

2 * Int ( Random * 5 ) + 2

But see also:

http://fmforums.com/forum/showpost.php?post/299804/

Share this post


Link to post
Share on other sites

Thank You very much for the link.

however what about if

min=3

max=13

result=odd number

2 * Int ( Random * 5 ) + 2

how to plot to that equation?

My goal is to create universal formula to generate even/odd number within range.

ex) min, max

resulted in "Even"/"Odd" number within specified range.

Please help

Edited by Guest

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
Sign in to follow this  

×

Important Information

By using this site, you agree to our Terms of Use.