I am aware that in KDB, if you have a list like...
l:`apples`oranges`pears`
You can make N random selections like as follows:
9?l
But how do I evenly select each of the items in the list whenever possible?
I am aware that in KDB, if you have a list like...
l:`apples`oranges`pears`
You can make N random selections like as follows:
9?l
But how do I evenly select each of the items in the list whenever possible?
You can use '#' operator to take N elements of list and do a permutation(0N?) of the result.
q) l:`apples`oranges`pears
q) 0N?6#l / take and permutation
q) `pears`oranges`apples`apples`oranges`pears