• API
• FAQ
• Tools
• Archive
SHARE
TWEET

# Untitled

a guest Aug 25th, 2019 52 Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
1. ten5  = 100000
2. ten8  = 100000000
3. ten9  = 1000000000
4. ten10 = 10000000000
5.
6. def krng(x):
7.     iterations = x/ten9 + 1
8.
9.     while iterations > 0:
10.         step = (x/ten8) % 10 + 3
11.
12.         if step == 3:
13.             if x < 5000000000L:
14.                 x += 5000000000L
15.             step += 1
16.
17.         if step == 4:
18.             x = ((x*x)/ten5) % ten10
19.             step += 1
20.
21.         if step == 5:
22.             x = (1001001001L*x) % ten10
23.             step += 1
24.
25.         if step == 6:
26.             if x < ten8:
27.                 x += 9814055677L
28.             else:
29.                 x = ten10 - x
30.             step += 1
31.
32.         if step == 7:
33.             x = ten5*(x % ten5) + (x/ten5)
34.             step += 1
35.
36.         if step == 8:
37.             x = (1001001001L*x) % ten10
38.             step += 1
39.
40.         if step == 9:
41.             s = 1
42.             t = x
43.             for i in range(10):
44.                 if t % 10 > 0:
45.                     x -= s
46.                 s *= 10
47.                 t /= 10
48.             step += 1
49.
50.         if step == 10:
51.             if x < ten5:
52.                 x = x*x + 99999L
53.             else:
54.                 x -= 99999L
55.             step += 1
56.
57.         if step == 11:
58.             while x < ten9:
59.                 x *= 10
60.             step += 1
61.
62.         if step == 12:
63.             x = ((x*(x-1))/ten5) % ten10
64.             step += 1
65.
66.         iterations -= 1
67.
68.     return int(x)
69.
70. print krng(6065038420L)
RAW Paste Data
We use cookies for various purposes including analytics. By continuing to use Pastebin, you agree to our use of cookies as described in the Cookies Policy.

Top