I have a collection of lists containing random elements of a sequence, say integers from 0 to 3.
sequence={0., 1., 2., 3.};
Table[RandomSample[sequence, RandomInteger[{1, 4}]], {5}]
{{3., 0., 1.}, {3., 1., 0., 2.}, {1., 3.}, {1., 3., 0., 2.}, {0., 2., 3.}}
How do I populate the lists so that the missing sequence members are filled?
{{3., 0., 1., 2.}, {3., 1., 0., 2.}, {1., 3., 0., 2.}, {1., 3., 0., 2.}, {0., 2., 3., 1.}}
Note: answers where elements are Integer
s are fine but I'm also looking for answers which work for Real
elements.