Class: Sperm::Groups::ZpMulShuffler

Inherits:
Object
  • Object
show all
Defined in:
lib/sperm/groups/multiplicative_shuffler.rb

Overview

Generates random cyclic representations of (Z/pZ \ 0, *).

Instance Method Summary collapse

Constructor Details

#initialize(isomorphism, rand_source) ⇒ ZpMulShuffler


5
6
7
# File 'lib/sperm/groups/multiplicative_shuffler.rb', line 5

def initialize(isomorphism, rand_source)
  @isomorphism, @rand_source = isomorphism, rand_source
end

Instance Method Details

#randObject


9
10
11
12
# File 'lib/sperm/groups/multiplicative_shuffler.rb', line 9

def rand
  first = 1 + @rand_source.rand(mul_group.modulo - 1)
  mul_group.produce_cycle(first, rand_mul_generator).lazy
end