[LON-CAPA-users] random_permutation, choosing the $seed

Peter Dencker dencker at math.uni-luebeck.de
Mon Sep 1 04:45:00 EDT 2014

Hello, Gerd.

The given problem compares the procedures for lists with 2,3,4 and 5
elements running both procedures in each case 10000 times. (The number
10000 is not the number of the shuffled items.)

The shown tables are tables of absolute frequencies.  An example using
the seed range 1 .. 1E8 is the following. (Choosing the seeds between 1
and 1E8 doesn't change the behavior.)

10000 random permutations of ABC counted:
       shuffle	permute
ABC	1670	 2254
ACB	1661	 1555
BAC	1609	 1785
BCA	1728	 1900
CAB	1653	 1406
CBA	1679	 1100

The difference in the number of, e.g., 'CBA' and 'ABC' in the right
column seems to be a systematic effect. I tried to express this by using
the term 'bias'.

- Peter

Am 01.09.2014 03:14, schrieb Gerd Kortemeyer:
> Hi Again,
> On Aug 31, 2014, at 8:59 PM, Gerd Kortemeyer <kortemey at msu.edu> wrote:
>> The problem may be 1e10 as upper limit - that’s awfully big. While I am unable to verify this right now, I have a vague feeling that a 32-bit integer is expected inside &random_permutation(), and that weird things could happen with the overflows or “negatives.” Maybe try with 1e8 (which is smaller than 2^31) and see if the bias goes away.
> I am not sure what “bias” is in this context means, but I just noticed that your array appears to have 10,000 elements, which means there are 10,000! different permutations. Of course 10,000! >> 1e10, so with the a random seed between 1 and 1e10, you’ll never “hit” all possible permutations - is that the “bias”?
> - Gerd.
> _______________________________________________
> LON-CAPA-users mailing list
> LON-CAPA-users at mail.lon-capa.org
> http://mail.lon-capa.org/mailman/listinfo/lon-capa-users

Dr. Peter Dencker
    wissenschaftl. Mitarbeiter


    Ratzeburger Allee 160
    23562 Lübeck

    Tel +49 451 500 4254
    Fax +49 451 500 3373
    dencker at math.uni-luebeck.de


More information about the LON-CAPA-users mailing list