LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

Random number generator. Even and odd numbers

Solved!
Go to solution

Alt is our guiding light.  😉

Bill
CLD
(Mid-Level minion.)
My support system ensures that I don't look totally incompetent.
Proud to say that I've progressed beyond knowing just enough to be dangerous. I now know enough to know that I have no clue about anything at all.
Humble author of the CLAD Nugget.
Message 11 of 24
(2,978 Views)

excluding the 'zero'....

Example_VI.png

Message 12 of 24
(2,967 Views)

@apok wrote:

@RavensFan wrote:

 

Spoiler

Create the array.  Use quotient remainder to divide by 2.  Now you have an array where all the odd numbers are now 1, and all the even numbers are now 0.  Sum the array and you have the total number of odd numbers.  The number of evens will be the length of the array divided by the # of odds.

 



"The number of evens will be the length of the array divided by the # of odds."......you mean subtracted not divided?


Yes.  I think I had divided still on my mind from talking about the Q&R function.

0 Kudos
Message 13 of 24
(2,960 Views)

@apok wrote:

excluding the 'zero'....

Example_VI.png


Why are you excluding zero?  It is an even number also.

0 Kudos
Message 14 of 24
(2,955 Views)

@apok wrote:

excluding the 'zero'....


The original problem deals with random number is the range of 0 to 20, thus zero should not be excluded. If zero should not occur, the random generator needs to be changed to generate numbers from 1..20.

0 Kudos
Message 15 of 24
(2,946 Views)

i revised my last post to include the # of zero's...

 

Spoiler
odd even zero numbers in array.png

 

Message 16 of 24
(2,940 Views)
Solution
Accepted by topic author Mr_Lordi

As has been said, zero is an even number, so I would suggest not to escalate the issues by adding complications that are not requested.

 

Here's all that's needed. (I included the random generator, because many users take shortcuts that give lower probabilities for the first and last element.)

 

 

 

Message 17 of 24
(2,930 Views)

@altenbach wrote:

As has been said, zero is an even number, so I would suggest not to escalate the issues by adding complications that are not requested.

 

Here's all that's needed. (I included the random generator, because many users take shortcuts that give lower probabilities for the first and last element.)

 

 

 


sorry for the mis-direction on my part,"excluding zero".....

 

Spoiler
odd even zero numbers in array.png

 

0 Kudos
Message 18 of 24
(2,908 Views)

Thank you very much!

 

This is exactly what I need, I can´t thank you enough.

0 Kudos
Message 19 of 24
(2,857 Views)

Thank you for your help

0 Kudos
Message 20 of 24
(2,854 Views)