Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #**Narzew's Pseudo Int Generator
- $narzew_pseudo_key = Time.now.to_i
- $narzew_pseudo_last = 0
- module NarzewRand
- def self.set_key(x)
- $narzew_pseudo_key = x
- end
- def self.set_key_as_time
- $narzew_pseudo_key = Time.now.to_i
- end
- def self.zero_key
- $narzew_pseodo_key = 0
- end
- def self.zero_last
- $narzew_pseudo_last = 0
- end
- def self.gen_rand(x,round=true)
- a = $narzew_pseudo_last + 113
- b = ($narzew_pseudo_last*2 + ($narzew_pseudo_key/2))
- c = b*3+a*4
- d = (((c*b*2*5).to_f/1977)+1)
- e = d+$narzew_pseudo_key *2 + 7
- f = (e.to_f/500)-86
- g = (((f+911*$narzew_pseudo_last)*(f+985*$narzew_pseudo_key))/2)
- h = (g-f*113)+865
- i = (((h-913947)*2)%(x+1))
- $narzew_pseudo_last = i
- if round == false
- return i
- else
- return i.to_i
- end
- end
- end
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement