# RandomChoice inside RandomChoice

I have spent a half hour searching Mathematica.SE for information on this topic, with no luck. The code is:

RandomChoice[
{40, 30, 1} ->
{BlockRandom[RandomChoice[{0, 0}], RandomSeeding -> Automatic],
BlockRandom[RandomChoice[{1, 5}], RandomSeeding -> Automatic],
BlockRandom[RandomChoice[{6, 10}], RandomSeeding -> Automatic]},
20]


A typical output is:

{0, 5, 5, 0, 0, 0, 5, 5, 0, 0, 0, 5, 5, 0, 5, 0, 5, 0, 5, 0}


Why does the code give only the same two numbers repeatedly? isn't RandomSeeding supposed to prevent this type of output?

• Use RuleDelayed instead of Rule, e.g., RandomChoice[{40, 30, 1} :> {..}]. – Carl Woll May 18 '18 at 1:13
• That works great, thanks! – Michael B. Heaney May 18 '18 at 1:34
• It looks like using RuleDelayed also obviates using BlockRandom and RandomSeeding! – Michael B. Heaney May 18 '18 at 1:41