Even numbers from float random numbers

Hello, how can I get only even numbers from a random float list of even numbers in grasshopper?
i can get only even numbers from integer random numbers.

What does that mean? I don’t understand your brief description :question:

3. Attach minimal versions of all the relevant files

I want get even numbers from float numbers list…
but i just can get even numbers from integer numbers list.
so, how can get even numbers from float numbers?

Looks like you need either:

  1. a tolerance on the comparison
  2. some rounding when generating the numbers in the sequence
1 Like

Does it exist ?


If I understand you, you want the numbers whose last decimal digit is an even number:

evens.gh (12.1 KB)

1 Like

<— not a GH expert so I’m making some assumptions about how the components in the screenshot work.

My assumption had been that he wanted numbers which “should” be even, such as 8.0 in his screenshot, to make it through the list.

Because he’s interpolating between values by adding a non-integer increment between them, sometimes the answer isn’t “quite” right.

In the screenshot, his 4.0 is “close enough” to 4 for the comparison to succeed but 8.0 is probably something like 7.99999 and fails.