public void Shuffle1() { var src = Perm.Identity(24); Perm dst0 = src; Perm dst1 = Random.Shuffle(src.Replicate()); Perm dst2 = Random.Shuffle(src.Replicate()); Perm dst3 = Random.Shuffle(src.Replicate()); Claim.eq(dst1.Length, src.Length); Claim.eq(dst2.Length, src.Length); Claim.eq(dst3.Length, src.Length); }
public void permrev_64x64() { for(var i= 0; i<SampleSize; i++) { //Creates an "exchange" matrix var perm = Perm.Identity(n64).Reverse(); var mat = perm.ToBitMatrix(); var v1 = Random.BitVector(n64); var v2 = mat * v1; var v3 = v1.Replicate(); v3.Reverse(); Claim.eq(v3,v2); } }
OpTime Shuffle(int n, int count, out int duplicates) { duplicates = 0; var sw = stopwatch(); var p0 = Perm.Identity(n); var p1 = Random.Shuffle(in p0); var p2 = Random.Shuffle(in p0); for (var i = 0; i < count; i++) { p1 = Random.Shuffle(in p1); p2 = Random.Shuffle(in p2); if (p1 == p2) { duplicates++; } } return(count, snapshot(sw)); }