RosettaCodeData/Task/Sleeping-Beauty-problem/Excel/sleeping-beauty-problem.excel
2023-07-01 13:44:08 -04:00

18 lines
337 B
Text

SLEEPINGB
=LAMBDA(n,
LET(
headsWakes, LAMBDA(x,
IF(1 = x,
{1,1},
{0,2}
)
)(
RANDARRAY(n, 1, 0, 1, TRUE)
),
CHOOSE(
{1,2},
SUM(INDEX(headsWakes, 0, 1)),
SUM(INDEX(headsWakes, 0, 2))
)
)
)