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:

.queryParam(“priority”,randomPick([10,“0”],[90,“1”))

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?

Thanks,
Rob

Write your own Scala function for this.