Randomized points on curve

Hello
I’m trying to build a script that places facade tiles of different widths on a wall surface in a randomized order. So far I managed to create the horizontal lines onto where tiles are suppose to sit on. I now want to create points (in a randomized order) on each curve with a spacing of either 500 or 300mm. My problem is that my points are aligned, so I’m not getting each line randomized??

This post is a continuing post from this one: Evenly spaced horizontal curves on face

1 Like

@eklund.rickard ,

List.Shuffle is very useful!

KR

Andreas

Hello Andreas!
Yes, but my problem is that I need to shuffle each curves points so that I dont get the points aligned in the the vertical direction. So I guess, how do I apply the shuffle for each line?

@eklund.rickard ,

countnumber + cycle the items…

KR

Andreas

Not sure if I’m doing it wrong but I still get points that are aligned:

I managed to get the result I’m after by doing this but since the number of curves will not variey this won’t work I think:

As you can see from your latest working example, you need one list per curve and you obviously don’t want the lists to be the same. Shuffling the same list with the same seed will give you the same result, so you either need to provide different initial lists or different seeds. Different seeds is probably easier. Just take a single starting seed value and increment it for each list you have.

Now the initial list are all different. But now my List.Scan is doing something wrong :slight_smile:

It works when I feed it only one list:

I don’t think you need that anymore since you have individual lists now. What was the original reason for it?

The List.Scan?

Yes. Originally you were providing it a single list, but now you have unique lists for each curve already.

I think in order to calculate the cumulative sum I need it. If I just feed the the shuffeled list I get a result like this? I think if I could use list levels in List.Scan it would work?

Oh gotcha. Unfortunately, List.Scan does not have list levels. However, in general, you’re going to have better luck with list levels and the right node over something like List.Scan or List.Map anyway.

In this case, you can get a cumulative sum by working your way up the list of values with a total sum.

2 Likes

Try using Random List with seed to generate variations


Random.dyn (15.5 KB)

3 Likes

Thanks @Nick_Boyts Nick and @Vikram_Subbaiah !
This works perfect! I will also try to add a function that lets you choose the percentage of plates, like 70% of plates A and 30% of plates B.

1 Like