lib/knuth.rb
# warmup_random - initializes a random number generator.
# rubocop:disable Metrics/MethodLength
initializes a random number generator.
initializes a random number generator .
def warmup_random(random_seed)
    @random_number_array[54] = random_seed
    new_random = 1e-9
    prev_random = random_seed
    (0..53).each do |index|
      random_index = 21 * (index + 1) % 54
      @random_number_array[random_index] = new_random
      new_random = prev_random - new_random
      new_random += 1 if new_random < 0
      prev_random = @random_number_array[random_index]
    end
    3.times { advance_random }
    @random_number = 0
    nil
  end
def warmup_random ( random_seed ) @random_number_array [ 54 ] = random_seed new_random = 1e-9 prev_random = random_seed ( 0 .. 53 ) . each do | index | random_index = 21 * ( index + 1 ) % 54 @random_number_array [ random_index ] = new_random new_random = prev_random - new_random new_random += 1 if new_random < 0 prev_random = @random_number_array [ random_index ] end 3 . times { advance_random } @random_number = 0 nil end
warmup_random - initializes a random number generator.
warmup_random - initializes a random number generator .
random_seed