Advertisement
Narzew

Narzew's PseudoInt Generator

Mar 30th, 2013
173
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Ruby 0.78 KB | None | 0 0
  1. #**Narzew's Pseudo Int Generator
  2. $narzew_pseudo_key = Time.now.to_i
  3. $narzew_pseudo_last = 0
  4. module NarzewRand
  5.     def self.set_key(x)
  6.         $narzew_pseudo_key = x
  7.     end
  8.     def self.set_key_as_time
  9.         $narzew_pseudo_key = Time.now.to_i
  10.     end
  11.     def self.zero_key
  12.         $narzew_pseodo_key = 0
  13.     end
  14.     def self.zero_last
  15.         $narzew_pseudo_last = 0
  16.     end
  17.     def self.gen_rand(x,round=true)
  18.         a = $narzew_pseudo_last + 113
  19.         b = ($narzew_pseudo_last*2 + ($narzew_pseudo_key/2))
  20.         c = b*3+a*4
  21.         d = (((c*b*2*5).to_f/1977)+1)
  22.         e = d+$narzew_pseudo_key *2 + 7
  23.         f = (e.to_f/500)-86
  24.         g = (((f+911*$narzew_pseudo_last)*(f+985*$narzew_pseudo_key))/2)
  25.         h = (g-f*113)+865
  26.         i = (((h-913947)*2)%(x+1))
  27.         $narzew_pseudo_last = i
  28.         if round == false
  29.             return i
  30.         else
  31.             return i.to_i
  32.         end
  33.     end
  34. end
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement