Forum Discussion
Working with Binary numbers BASE(..., 2, 7) and bit operations BITXOR, BITAND
m_tarlerYes, having a repeatable random function can come in handy, I've quite often divided by 2^32 to get a non-volatile RAND alternative
PeterBartholomew1 Indeed, another possible candidate might be a 'combinations' function,
=combinations({"a";"b";"c";"d"},2)
which would return {"a","b";"a","c";"b","c";"a","d";"b","d";"c","d"}. I had been thinking about this off and on for a while but like SergeiBaklan couldn't see any reasonable route. I revisited again in light of the bisection method you provided recently based on a recursion over an array version of,
COMBIN(n,k) = COMBIN(n-1,k-1) + COMBIN(n-1,k)
For example with the following lambda definition =combinations(sequence(20),10) returns COMBIN(20,10)*10=1847560 elements.
combinations
=LAMBDA(arr, k,
IF(
k <= ROWS(arr),
IF(
k = 1,
arr,
DROP(
VSTACK(
combinations(DROP(arr, -1), k),
EXPAND(combinations(DROP(arr, -1), k - 1), , k, @TAKE(arr, -1))
),
k = ROWS(arr)
)
)
)
)
Just to add I should have checked the archives before posting the above formula. Two good alternative methods that came up in search results were (not coincidentally by both aforementioned contributors)
Evidence that there are sufficient high quality examples available now to build general purpose libraries of lambdas.