We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
1 parent fe917f0 commit e52e190Copy full SHA for e52e190
csharp_rand.py
@@ -37,6 +37,7 @@ def __call__(self, vec):
37
38
class csharp_rand:
39
sa = {
40
+ -56: rand_vec(0, 0), # SeedArray[0] is unused?
41
-55: rand_vec(995627988, 1440537475),
42
-54: rand_vec(2027951972, 765327687),
43
-53: rand_vec(670659949, 2146736586),
@@ -98,6 +99,7 @@ def sample_equation(self, rand_i: int) -> rand_vec:
98
99
"""
100
What constants are needed to produce the `i`th PRNG from Random?
101
102
+ assert rand_i >= -56
103
if ret := self.sa.get(rand_i, None): # try from cache
104
return ret
105
@@ -114,6 +116,13 @@ def sample(self, seed, i) -> int:
114
116
def inv(self, rand, i) -> int:
115
117
return self.sample_equation(i).invert().resolve(rand)
118
119
+ def dump_seed_array(self, seed):
120
+ for i in range(0, 56):
121
+ myind = i - 56
122
+ val = self.sample(seed, myind)
123
+ print(f"SeedArray[{i}]: {val}")
124
+
125
126
127
def test_rand():
128
import json
AltStyle によって変換されたページ (->オリジナル) / アドレス: モード: デフォルト 音声ブラウザ ルビ付き 配色反転 文字拡大 モバイル
0 commit comments