Problem with Random Numbers in Replace Items

unhandled

(Starzred) #1

Dear All

Hi there, I am doing an exercise on Replace Items where I have generated a sent of random intergers and plugged to the List Item (I) for selecting the indices to be replaced by a circle in a square grid.
However as you can see in the attached file, I have set the Number in the Random as 20 but the number of circles produced (only 14) do not match. I have tried other values and the same problem persists.

Would anyone know the reason and how to get the exact numbers of random values to be replaced?

Many thanks indeed!

Kind regrds
Yutaka

replace items with ramdom numbers.gh (17.2 KB)


#2

There are probably duplicate integer numbers generated from Random component.

If you delete those duplicate integer numbers usingCreate Set and probably the ramaining distinct numbers gonna be 14.


(Starzred) #3

Thank you so much Kim, yes that’s the case.
Would there be a way to limit the Random results to unique integers?

Many thanks!

Yutaka