Itoo Software Forum

Author Topic: How to do selective randomization?  (Read 399 times)

IvanK

  • Newbie
  • *
  • Posts: 4
How to do selective randomization?
« on: March 20, 2020, 07:29:53 PM »
Hi! I can't figure out how to get the pattern:

The pattern I is made of few areas distributed on Y  (with or without horizontal dividers). Inside every area, a random amount of horizontal rows and every area has its own random sequence on X only.

I made the first: few areas distributed on Y with horizontal dividers, but I can't get the second: individual randomization on X sequence inside each area.

Regards, Ivan.

Attaching the max file:
https://www.dropbox.com/s/3ju79f5xp8y1r4a/RC_RandomPanels.max?dl=0

Paul Roberts

  • iToo Software
  • Hero Member
  • *****
  • Posts: 1770
Re: How to do selective randomization?
« Reply #1 on: March 23, 2020, 01:19:40 PM »
Hi,

Thanks for your question. This problem is a little trickier than it looks because none of the existing randomisation options quite allow for this level of control over when a random value is generated. For a workaround please see the attached file. You'll see a strange-looking expression in one of the Arithmetic nodes. This is being used to try to generate a pseudorandom number over which I had a little more control. I've written it so that it generates a new random value based on the Nested generators position on Y-axis and the individual segment's position on the X-axis



I've exported a seed value you can use too, but be aware that some number work better than others, and Prime number seems to be giving better results.

I hope that helps for now. We'll add more randomisation options to our wish list.

All the best,

Paul
Paul Roberts
iToo Software

Dragan

  • Hero Member
  • *****
  • Posts: 566
Re: How to do selective randomization?
« Reply #2 on: March 23, 2020, 01:52:35 PM »
Paul !!!! :o $#@%$#%##!!!!   :D :D
I guess the formula for the Corona Vaccine will be easier to find compare to this expression!!!  ;D ;D ;D
Great Job!!!
I take a look at this problem also and at my initial setup idea I run into a problem with the Selector`s Index.
I try to send random X-Sequences trough Selector to new Y-Sequence with random Counter Index but that did not work.
Please, can you check it for me? I know in theory what is the problem but can`t clarify myself.


« Last Edit: March 23, 2020, 01:54:27 PM by Dragan »

Paul Roberts

  • iToo Software
  • Hero Member
  • *****
  • Posts: 1770
Re: How to do selective randomization?
« Reply #3 on: March 23, 2020, 02:27:11 PM »
Please take a look at the attached. If I've understood correctly what you wanted then seems a little more straightforward with no weird maths required!

Cheers,

Paul
Paul Roberts
iToo Software

Dragan

  • Hero Member
  • *****
  • Posts: 566
Re: How to do selective randomization?
« Reply #4 on: March 23, 2020, 03:28:34 PM »
Yup! That`s it. Thank you Paul.
Do we need some more `Generate on`modes for Random Parameter so the combination of Selector>>Sequence could work fine? Although this Nesting is just simple and fine.

And one more thing I think if Random Parameter for Selector is set to Generate on Segment it will mess up the unique X-Sequence order (but I still have to check this statement).
« Last Edit: March 23, 2020, 03:32:13 PM by Dragan »

Dragan

  • Hero Member
  • *****
  • Posts: 566
Re: How to do selective randomization?
« Reply #5 on: March 23, 2020, 03:47:59 PM »
One more!!!   8)
Could it be possible for Sequence Operator to use the NULL segment? Now if I attach the NULL segment it will break/end the sequence order. This behaviour is preventing of preparing some Macros with e.g. 10 inputs but only few to be used. Now I need to make some combination of Compose inputs+NULL with small X/Y size values and this is not ideal.

Best Regards.
 

Paul Roberts

  • iToo Software
  • Hero Member
  • *****
  • Posts: 1770
Re: How to do selective randomization?
« Reply #6 on: March 23, 2020, 05:00:56 PM »
That's it. We need to control more accurately when a random number is generated. Regarding the null and sequence issue. We'll look into what can be done about that, but I would be reluctant to remove the current behaviour because I have used it many times on purpose to deliberately end the length of an array that has many segments with a different X Size.

Cheers,

Paul
Paul Roberts
iToo Software

Dragan

  • Hero Member
  • *****
  • Posts: 566
Re: How to do selective randomization?
« Reply #7 on: March 23, 2020, 05:12:57 PM »
I can agree with the use of the NULL for Sequence termination but as I can see now, NULL with X/Y size is acting well so maybe just to see if the Opposite situation could work:
NULL with some X/Y size to be used for termination and `zero` NULL for `healing/continuing` the Sequence.
Thank you.

Paul Roberts

  • iToo Software
  • Hero Member
  • *****
  • Posts: 1770
Re: How to do selective randomization?
« Reply #8 on: March 23, 2020, 05:16:13 PM »
Well, I may use a Null with an X/Y size to deliberately create a space in the array. But maybe a negative size could work. There is another issue though, the reason a 0 size terminates the array is because if we didn't do that it could happen that RailClone tries to fill a Spline with 0 sized segments which would create an infinite loop.
Paul Roberts
iToo Software

Dragan

  • Hero Member
  • *****
  • Posts: 566
Re: How to do selective randomization?
« Reply #9 on: March 23, 2020, 05:18:57 PM »
Understandable, so then it is about time to introduce a new NULL SEGMENT in Object section with some useful parameters  ;)!

Paul Roberts

  • iToo Software
  • Hero Member
  • *****
  • Posts: 1770
Re: How to do selective randomization?
« Reply #10 on: March 23, 2020, 05:28:44 PM »
It's starting to look like it!
Paul Roberts
iToo Software

IvanK

  • Newbie
  • *
  • Posts: 4
Re: How to do selective randomization?
« Reply #11 on: March 24, 2020, 03:26:48 PM »
WOW! Thank you very much!!!!

Ronen B

  • Newbie
  • *
  • Posts: 7
Re: How to do selective randomization?
« Reply #12 on: March 25, 2020, 03:41:46 PM »
Hi,

Thanks for your question. This problem is a little trickier than it looks because none of the existing randomisation options quite allow for this level of control over when a random value is generated. For a workaround please see the attached file. You'll see a strange-looking expression in one of the Arithmetic nodes. This is being used to try to generate a pseudorandom number over which I had a little more control. I've written it so that it generates a new random value based on the Nested generators position on Y-axis and the individual segment's position on the X-axis



I've exported a seed value you can use too, but be aware that some number work better than others, and Prime number seems to be giving better results.

I hope that helps for now. We'll add more randomisation options to our wish list.

All the best,

Paul

Big thanks Paul!

One more thing... is there a way to force showing only FULL panels as I make the splines for X and Y longer or shorter? No scaling of panels (which we have on X) and no Slicing of panels (which we have on Y)...

Rokas

  • iToo Software
  • Hero Member
  • *****
  • Posts: 2674
    • iToo
Re: How to do selective randomization?
« Reply #13 on: March 25, 2020, 03:49:21 PM »
For this disable Segments slicing:

Rokas
iToo Software

Ronen B

  • Newbie
  • *
  • Posts: 7
Re: How to do selective randomization?
« Reply #14 on: March 26, 2020, 11:47:05 AM »
For this disable Segments slicing:



Yep! That did the work on the Y(Z) Axis ;)
Still working out the X ...

Thanks