Random Switch Query Param Equivalent

I’d like to implement something that chooses a queryParam randomly based on a percentage based ratio and some options. Eg:


Struggling with the best way to implement this in scala - I’d like a function I think (rather than using the chainbuilder ‘randomSwitch’) as I’ll be doing this for many queryParams

Any suggestions/code samples?


Write your own Scala function for this.