help-gsl
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Help-gsl] Knuth Shuffling a list twice with no identical number at iden


From: Awhan Patnaik
Subject: [Help-gsl] Knuth Shuffling a list twice with no identical number at identical position
Date: Thu, 19 Feb 2009 16:22:49 +0530

Array1 = {1,2,3,...,N}
Array2 = {1,2,3,...,N}

I want to randomly shuffle both the lists so that I end with two lists that
don't have identical elements at identical position. i.e. the following
situation should never occur

Array1[i] = Array2[i] for some i in [1,N]

I invoked gsl_ran_shuffle() once on each array in succession but was not
able to achieve the desired result every time. A non-elegant (ugly) solution
is to compare the lists and shuffle any one of them until there is no match
at identical positions.

Any help or pointer in this regard ?


reply via email to

[Prev in Thread] Current Thread [Next in Thread]