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

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

Sign in to follow this  

×
×
  • Create New...

Important Information

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