Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 4 additions & 4 deletions lib/addcoset.gi
Original file line number Diff line number Diff line change
Expand Up @@ -142,11 +142,11 @@ InstallMethod( IsFinite,
##
#M Random( <A> ) . . . . . . . . . . . . . . . . . . . . for additive cosets
##
InstallMethod( Random,
"for an additive coset",
InstallMethodWithRandomSource( Random,
"for a random source and an additive coset",
true,
[ IsAdditiveCoset ], 0,
A -> Representative( A ) + Random( AdditivelyActingDomain( A ) ) );
[ IsRandomSource, IsAdditiveCoset ], 0,
{rs, A} -> Representative( A ) + Random( rs, AdditivelyActingDomain( A ) ) );


#############################################################################
Expand Down
2 changes: 1 addition & 1 deletion lib/coll.gi
Original file line number Diff line number Diff line change
Expand Up @@ -267,7 +267,7 @@ end );


RedispatchOnCondition(Random,true,[IsCollection],[IsFinite],0);
RedispatchOnCondition(Random,true,[IsRandomSource,IsCollection],[IsFinite],0);
RedispatchOnCondition(Random,true,[IsRandomSource,IsCollection],[,IsFinite],0);

#############################################################################
##
Expand Down
2 changes: 1 addition & 1 deletion lib/grpnice.gi
Original file line number Diff line number Diff line change
Expand Up @@ -783,7 +783,7 @@ SubgroupMethodByNiceMonomorphism( RadicalGroup,
##
#M Random( <G> )
##
InstallMethod( Random,
InstallMethodWithRandomSource( Random,
"for a random source and a group handled by nice monomorphism",
[ IsRandomSource, IsGroup and IsHandledByNiceMonomorphism ], 0,
{rs, G} -> PreImagesRepresentative( NiceMonomorphism( G ),
Expand Down
9 changes: 5 additions & 4 deletions lib/oprt.gi
Original file line number Diff line number Diff line change
Expand Up @@ -294,15 +294,16 @@ function( xset )
return Orbit(xset,Representative(xset));
end);

InstallMethod( Random,"for external orbit: via acting domain", true,
[ IsExternalOrbit ], 0,
function( xset )
InstallMethodWithRandomSource( Random,
"for a random source and for an external orbit: via acting domain", true,
[ IsRandomSource, IsExternalOrbit ], 0,
function( rs, xset )
if HasHomeEnumerator(xset) and not IsPlistRep(HomeEnumerator(xset)) then
TryNextMethod(); # can't do orbit because the home enumerator might
# imply a different `PositionCanonical' (and thus equivalence of objects)
# method.
fi;
return FunctionAction(xset)(Representative(xset),Random(ActingDomain(xset)));
return FunctionAction(xset)(Representative(xset),Random(rs, ActingDomain(xset)));
end);

#############################################################################
Expand Down
28 changes: 28 additions & 0 deletions tst/testinstall/random.tst
Original file line number Diff line number Diff line change
Expand Up @@ -105,6 +105,34 @@ gap> randomTest(SL(3,3), Random);
gap> randomTest(GL(2,2), Random);
gap> randomTest(GL(3,3), Random);

#
# additive cosets
#
gap> randomTest(AdditiveCoset(ZmodnZ(1),Identity(ZmodnZ(1))),Random);
gap> randomTest(AdditiveCoset(Integers,2),Random);
gap> randomTest(AdditiveCoset(CF(5),-2/3*E(5)-1/2*E(5)^2+1/3*E(5)^4),Random);
gap> randomTest(AdditiveCoset(GF(17),Z(17)^9),Random);
gap> R := SmallRing(10,2);;
gap> randomTest(AdditiveCoset(R,5*R.1),Random);
gap> a:= Algebra( GF(2), [ [ [ Z(2) ] ] ] );;
gap> rm:= FreeMagmaRing( GF(2), a );;
gap> randomTest(AdditiveCoset(rm, rm.1), Random);

#
# external orbits
#
gap> g:=DihedralGroup(8);; orbs:=ExternalOrbits(g,AsList(g));;
gap> for orb in orbs do
> randomTest(orb,Random);
> od;

#
gap> g:=SymmetricGroup(4);;
gap> orbs:=ExternalOrbits(g,[1..4]);;
gap> for orb in orbs do
> randomTest(orb,Random);
> od;

#
# other stuff
#
Expand Down