Itoo Software Forum

Author Topic: Expression for Weighted Randomization  (Read 1803 times)

SeanRedmond

  • Newbie
  • *
  • Posts: 16
Expression for Weighted Randomization
« on: September 27, 2022, 12:32:34 AM »
I'm trying to write an expression or node group that will let me select from input segments randomly, but with weights for added control.. I could use a selector and double up inputs but that doesn't allow as much control + gets pretty clunky. Does anyone have any solutions? Here is the solution I'm trying to translate to Railclone (and my poor attempt is there too).

https://imgur.com/sQDutex
https://imgur.com/S7ygL1x

Thanks!!

Paul Roberts

  • iToo Software
  • Hero Member
  • *****
  • Posts: 2991
Re: Expression for Weighted Randomization
« Reply #1 on: September 27, 2022, 09:23:12 AM »
HI,

If it's segments that you're trying to randomise, could you use the Random node? It already has built-in probability settings (called Presence)



Cheers,
Paul
Paul Roberts
iToo Software

SeanRedmond

  • Newbie
  • *
  • Posts: 16
Re: Expression for Weighted Randomization
« Reply #2 on: September 27, 2022, 03:13:11 PM »
Well this is embarrassing  ;D I had no idea that existed.

Thank you so much!