Json Array: add a custom distribution between the min and max number of elements

Hi

I’m wondering if it’s possible to define a json array with min and max values and also define a custom distribution (like you can in a custom list) that defines how many elements will occur in that array.

It might make more sense if I give an example.

I want to define a json array of products. I want it to contain between 0 and 5 products but then want it to be more likely that it will generate 3 products, and less likely it would specify 0 or 5.

i.e.

Each number in the table below represents how often that number of elements will occur relative to other amounts of elements. A value with “2” will occur twice as often as a value with “1”. All values are assigned a “1” when no rules are matched.

number of products in array, distribution
0, 10
1, 20
2, 30
3, 50
4, 30
5, 20

Not sure how best that can be achieved. I assume it would have to be a new feature. I guess it might be possible to do this via a function but i don’t know ruby enough to make one.

Cheers
Richard