updatePink :: PinkNoise-> Int -> Double->Double  -> PinkNoise
updatePink pn idx rnd  = PinkNoise
                            updateRow
                            updateRunningSum
                            updateIndex                            
  where updateRunningSum = runningSum pn + rnd - ( rows pn!!idx) 
        updateRow = let sp = splitAt idx (rows pn)
                    in case fst sp of
                        [] -> rnd:snd sp
                        _  -> init (fst sp) ++ [rnd] ++ snd sp
        updateIndex = (index pn + 1) .&. fromIntegral indexMask
updatePink :: PinkNoise-> Int -> Double->Double  -> PinkNoise
updatePink pn idx rnd  = PinkNoise
                            updateRow
                            updateRunningSum
                            updateIndex                            
  where updateRunningSum = runningSum pn + rnd - ( rows pn!!idx) 
        updateRow = let sp = splitAt idx (rows pn)
                    in case fst sp of
                        [] -> rnd:snd sp
                        _  -> init (fst sp) ++ [rnd] ++ snd sp
        updateIndex = (index pn + 1) .&. fromIntegral indexMask
updatePink pn idx rnd  = PinkNoise
                            updateRow
                            updateRunningSum
                            updateIndex                            
  where updateRunningSum = runningSum pn + rnd - ( rows pn!!idx) 
        updateRow = let sp = splitAt idx (rows pn)
                    in case fst sp of
                        [] -> rnd:snd sp
                        _  -> init (fst sp) ++ [rnd] ++ snd sp
        updateIndex = (index pn + 1) .&. fromIntegral indexMask