<commit_before>package com.rumblesan.scalaglitch.glitches

import com.rumblesan.scalaglitch.types._

import scalaz._, Scalaz._

import scala.util.Random
import math.{cos, sin, Pi}

import com.rumblesan.scalaglitch.util.RichBufferedImage._
import com.rumblesan.scalaglitch.util.CoordWrapper.wrapCoords
import com.rumblesan.scalaglitch.util.RichColor._

import java.awt.image.BufferedImage


object Pusher extends GlitchTypes {

  def apply(image: BufferedImage): GlitchedGif = {
 
    val rand = new Random()

    val (width, height) = image.getSize()

    val genGlitches = for {
      frames <- getFrameCount
      multiplier <- getFrameOffsetMultiplier
      frameOffset = (Pi / frames).toInt
      shifterGen <- shifterGenerator(width)(height)
      images = for {
        f <- (1 to frames)
        offset = sin(f * frameOffset) * multiplier
        shifter = shifterGen(offset)
        runPusher = pusherGenerator(shifter)
      } yield image.createGlitch(runPusher)
    } yield images

    GlitchedGif(genGlitches.eval(rand).toList)

  }

  val getFrameCount = State[Random, Int] { rand =>
    (rand, rand.nextInt(300) + 100)
  }

  val getFrameOffsetMultiplier = State[Random, Int] { rand =>
    (rand, rand.nextInt(100))
  }

  val createShift: Int => State[Random, Int] = shiftMultiplier => State[Random, Int] { rand =>
    (rand, (rand.nextDouble() * shiftMultiplier).toInt)
  }


  val shifterGenerator: Int => Int => State[Random, Double => PixelShifter] = width => height => for {
    randXShift <- createShift(100)
    randYShift <- createShift(100)
    xShifter = (mult: Double) => createShifter(randXShift)(mult)<commit_msg>Fixing bug with frameOffset in Pusher<commit_after>package com.rumblesan.scalaglitch.glitches

import com.rumblesan.scalaglitch.types._

import scalaz._, Scalaz._

import scala.util.Random
import math.{cos, sin, Pi}

import com.rumblesan.scalaglitch.util.RichBufferedImage._
import com.rumblesan.scalaglitch.util.CoordWrapper.wrapCoords
import com.rumblesan.scalaglitch.util.RichColor._

import java.awt.image.BufferedImage


object Pusher extends GlitchTypes {

  def apply(image: BufferedImage): GlitchedGif = {
 
    val rand = new Random()

    val (width, height) = image.getSize()

    val genGlitches = for {
      frames <- getFrameCount
      multiplier <- getFrameOffsetMultiplier
      frameOffset = (Pi / frames)
      shifterGen <- shifterGenerator(width)(height)
      images = for {
        f <- (1 to frames)
        offset = sin(f * frameOffset) * multiplier
        shifter = shifterGen(offset)
        runPusher = pusherGenerator(shifter)
      } yield image.createGlitch(runPusher)
    } yield images

    GlitchedGif(genGlitches.eval(rand).toList)

  }

  val getFrameCount = State[Random, Int] { rand =>
    (rand, rand.nextInt(300) + 100)
  }

  val getFrameOffsetMultiplier = State[Random, Int] { rand =>
    (rand, rand.nextInt(100))
  }

  val createShift: Int => State[Random, Int] = shiftMultiplier => State[Random, Int] { rand =>
    (rand, (rand.nextDouble() * shiftMultiplier).toInt)
  }


  val shifterGenerator: Int => Int => State[Random, Double => PixelShifter] = width => height => for {
    randXShift <- createShift(100)
    randYShift <- createShift(100)
    xShifter = (mult: Double) => createShifter(randXShift)(mult)
{'fraction_non_alphanumeric': 0.11491813220133414, 'fraction_numerical': 0.009702850212249849, 'mean_word_length': 3.588317107093185, 'pattern_counts': {'":': 0, '<': 15, '<?xml version=': 0, '>': 25, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '4434606', 'n_tokens_mistral': 1143, 'n_tokens_neox': 1066, 'n_words': 230}