b67ec896baa491bd9623159dd2e7d92df7845ca2
[sfa.git] / server / jpywork / random.java
1 import org.python.core.*;
2
3 public class random extends java.lang.Object {
4     static String[] jpy$mainProperties = new String[] {"python.modules.builtin", "exceptions:org.python.core.exceptions"};
5     static String[] jpy$proxyProperties = new String[] {"python.modules.builtin", "exceptions:org.python.core.exceptions", "python.options.showJavaExceptions", "true"};
6     static String[] jpy$packages = new String[] {"java.net", null, "java.lang", null, "org.python.core", null, "java.io", null, "java.util.zip", null};
7     
8     public static class _PyInner extends PyFunctionTable implements PyRunnable {
9         private static PyObject s$0;
10         private static PyObject s$1;
11         private static PyObject s$2;
12         private static PyObject s$3;
13         private static PyObject s$4;
14         private static PyObject s$5;
15         private static PyObject s$6;
16         private static PyObject s$7;
17         private static PyObject s$8;
18         private static PyObject s$9;
19         private static PyObject s$10;
20         private static PyObject s$11;
21         private static PyObject s$12;
22         private static PyObject s$13;
23         private static PyObject s$14;
24         private static PyObject s$15;
25         private static PyObject s$16;
26         private static PyObject s$17;
27         private static PyObject s$18;
28         private static PyObject s$19;
29         private static PyObject s$20;
30         private static PyObject s$21;
31         private static PyObject s$22;
32         private static PyObject s$23;
33         private static PyObject f$24;
34         private static PyObject s$25;
35         private static PyObject i$26;
36         private static PyObject f$27;
37         private static PyObject f$28;
38         private static PyObject s$29;
39         private static PyObject f$30;
40         private static PyObject s$31;
41         private static PyObject f$32;
42         private static PyObject f$33;
43         private static PyObject s$34;
44         private static PyObject f$35;
45         private static PyObject f$36;
46         private static PyObject f$37;
47         private static PyObject s$38;
48         private static PyObject f$39;
49         private static PyObject i$40;
50         private static PyObject s$41;
51         private static PyObject s$42;
52         private static PyObject i$43;
53         private static PyObject i$44;
54         private static PyObject l$45;
55         private static PyObject i$46;
56         private static PyObject i$47;
57         private static PyObject i$48;
58         private static PyObject s$49;
59         private static PyObject i$50;
60         private static PyObject i$51;
61         private static PyObject i$52;
62         private static PyObject i$53;
63         private static PyObject i$54;
64         private static PyObject i$55;
65         private static PyObject f$56;
66         private static PyObject f$57;
67         private static PyObject f$58;
68         private static PyObject s$59;
69         private static PyObject s$60;
70         private static PyObject i$61;
71         private static PyObject s$62;
72         private static PyObject s$63;
73         private static PyObject s$64;
74         private static PyObject s$65;
75         private static PyObject s$66;
76         private static PyObject s$67;
77         private static PyObject i$68;
78         private static PyObject i$69;
79         private static PyObject s$70;
80         private static PyObject s$71;
81         private static PyObject s$72;
82         private static PyObject s$73;
83         private static PyObject s$74;
84         private static PyObject s$75;
85         private static PyObject s$76;
86         private static PyObject s$77;
87         private static PyObject s$78;
88         private static PyObject s$79;
89         private static PyObject s$80;
90         private static PyObject f$81;
91         private static PyObject f$82;
92         private static PyObject s$83;
93         private static PyObject s$84;
94         private static PyObject s$85;
95         private static PyObject f$86;
96         private static PyObject s$87;
97         private static PyObject s$88;
98         private static PyObject s$89;
99         private static PyObject s$90;
100         private static PyObject s$91;
101         private static PyObject s$92;
102         private static PyObject s$93;
103         private static PyObject s$94;
104         private static PyObject s$95;
105         private static PyObject s$96;
106         private static PyObject s$97;
107         private static PyObject s$98;
108         private static PyObject s$99;
109         private static PyObject s$100;
110         private static PyObject s$101;
111         private static PyObject s$102;
112         private static PyObject s$103;
113         private static PyObject s$104;
114         private static PyObject s$105;
115         private static PyObject s$106;
116         private static PyObject s$107;
117         private static PyObject s$108;
118         private static PyObject s$109;
119         private static PyObject i$110;
120         private static PyObject s$111;
121         private static PyObject s$112;
122         private static PyFunctionTable funcTable;
123         private static PyCode c$0__verify;
124         private static PyCode c$1___init__;
125         private static PyCode c$2_seed;
126         private static PyCode c$3_random;
127         private static PyCode c$4_getstate;
128         private static PyCode c$5_setstate;
129         private static PyCode c$6_jumpahead;
130         private static PyCode c$7__Random__whseed;
131         private static PyCode c$8_whseed;
132         private static PyCode c$9___getstate__;
133         private static PyCode c$10___setstate__;
134         private static PyCode c$11_randrange;
135         private static PyCode c$12_randint;
136         private static PyCode c$13_choice;
137         private static PyCode c$14_shuffle;
138         private static PyCode c$15_uniform;
139         private static PyCode c$16_normalvariate;
140         private static PyCode c$17_lognormvariate;
141         private static PyCode c$18_cunifvariate;
142         private static PyCode c$19_expovariate;
143         private static PyCode c$20_vonmisesvariate;
144         private static PyCode c$21_gammavariate;
145         private static PyCode c$22_stdgamma;
146         private static PyCode c$23_gauss;
147         private static PyCode c$24_betavariate;
148         private static PyCode c$25_paretovariate;
149         private static PyCode c$26_weibullvariate;
150         private static PyCode c$27_Random;
151         private static PyCode c$28__test_generator;
152         private static PyCode c$29__test;
153         private static PyCode c$30_main;
154         private static void initConstants() {
155             s$0 = Py.newString("Random variable generators.\012\012    integers\012    --------\012           uniform within range\012\012    sequences\012    ---------\012           pick random element\012           generate random permutation\012\012    distributions on the real line:\012    ------------------------------\012           uniform\012           normal (Gaussian)\012           lognormal\012           negative exponential\012           gamma\012           beta\012\012    distributions on the circle (angles 0 to 2pi)\012    ---------------------------------------------\012           circular uniform\012           von Mises\012\012Translated from anonymously contributed C/C++ source.\012\012Multi-threading note:  the random number generator used here is not thread-\012safe; it is possible that two calls return the same random value.  However,\012you can instantiate a different instance of Random() in each thread to get\012generators that don't share state, then use .setstate() and .jumpahead() to\012move the generators to disjoint segments of the full period.  For example,\012\012def create_generators(num, delta, firstseed=None):\012    \"\"\"Return list of num distinct generators.\012    Each generator has its own unique segment of delta elements from\012    Random.random()'s full period.\012    Seed the first generator with optional arg firstseed (default is\012    None, to seed from current time).\012    \"\"\"\012\012    from random import Random\012    g = Random(firstseed)\012    result = [g]\012    for i in range(num - 1):\012        laststate = g.getstate()\012        g = Random()\012        g.setstate(laststate)\012        g.jumpahead(delta)\012        result.append(g)\012    return result\012\012gens = create_generators(10, 1000000)\012\012That creates 10 distinct generators, which can be passed out to 10 distinct\012threads.  The generators don't share state so can be called safely in\012parallel.  So long as no thread calls its g.random() more than a million\012times (the second argument to create_generators), the sequences seen by\012each thread will not overlap.\012\012The period of the underlying Wichmann-Hill generator is 6,953,607,871,644,\012and that limits how far this technique can be pushed.\012\012Just for fun, note that since we know the period, .jumpahead() can also be\012used to \"move backward in time\":\012\012>>> g = Random(42)  # arbitrary\012>>> g.random()\0120.25420336316883324\012>>> g.jumpahead(6953607871644L - 1) # move *back* one\012>>> g.random()\0120.25420336316883324\012");
156             s$1 = Py.newString("Random");
157             s$2 = Py.newString("seed");
158             s$3 = Py.newString("random");
159             s$4 = Py.newString("uniform");
160             s$5 = Py.newString("randint");
161             s$6 = Py.newString("choice");
162             s$7 = Py.newString("randrange");
163             s$8 = Py.newString("shuffle");
164             s$9 = Py.newString("normalvariate");
165             s$10 = Py.newString("lognormvariate");
166             s$11 = Py.newString("cunifvariate");
167             s$12 = Py.newString("expovariate");
168             s$13 = Py.newString("vonmisesvariate");
169             s$14 = Py.newString("gammavariate");
170             s$15 = Py.newString("stdgamma");
171             s$16 = Py.newString("gauss");
172             s$17 = Py.newString("betavariate");
173             s$18 = Py.newString("paretovariate");
174             s$19 = Py.newString("weibullvariate");
175             s$20 = Py.newString("getstate");
176             s$21 = Py.newString("setstate");
177             s$22 = Py.newString("jumpahead");
178             s$23 = Py.newString("whseed");
179             f$24 = Py.newFloat(1.0E-7);
180             s$25 = Py.newString("computed value for %s deviates too much (computed %g, expected %g)");
181             i$26 = Py.newInteger(4);
182             f$27 = Py.newFloat(0.5);
183             f$28 = Py.newFloat(2.0);
184             s$29 = Py.newString("NV_MAGICCONST");
185             f$30 = Py.newFloat(1.71552776992141);
186             s$31 = Py.newString("TWOPI");
187             f$32 = Py.newFloat(6.28318530718);
188             f$33 = Py.newFloat(4.0);
189             s$34 = Py.newString("LOG4");
190             f$35 = Py.newFloat(1.38629436111989);
191             f$36 = Py.newFloat(1.0);
192             f$37 = Py.newFloat(4.5);
193             s$38 = Py.newString("SG_MAGICCONST");
194             f$39 = Py.newFloat(2.50407739677627);
195             i$40 = Py.newInteger(1);
196             s$41 = Py.newString("Initialize an instance.\012\012        Optional argument x controls seeding, as for Random.seed().\012        ");
197             s$42 = Py.newString("Initialize internal state from hashable object.\012\012        None or no argument seeds from current time.\012\012        If a is not None or an int or long, hash(a) is used instead.\012\012        If a is an int or long, a is used directly.  Distinct values between\012        0 and 27814431486575L inclusive are guaranteed to yield distinct\012        internal states (this guarantee is specific to the default\012        Wichmann-Hill generator).\012        ");
198             i$43 = Py.newInteger(256);
199             i$44 = Py.newInteger(3);
200             l$45 = Py.newLong("3");
201             i$46 = Py.newInteger(30268);
202             i$47 = Py.newInteger(30306);
203             i$48 = Py.newInteger(30322);
204             s$49 = Py.newString("Get the next random number in the range [0.0, 1.0).");
205             i$50 = Py.newInteger(171);
206             i$51 = Py.newInteger(30269);
207             i$52 = Py.newInteger(172);
208             i$53 = Py.newInteger(30307);
209             i$54 = Py.newInteger(170);
210             i$55 = Py.newInteger(30323);
211             f$56 = Py.newFloat(30269.0);
212             f$57 = Py.newFloat(30307.0);
213             f$58 = Py.newFloat(30323.0);
214             s$59 = Py.newString("Return internal state; can be passed to setstate() later.");
215             s$60 = Py.newString("Restore internal state from object returned by getstate().");
216             i$61 = Py.newInteger(0);
217             s$62 = Py.newString("state with version %s passed to Random.setstate() of version %s");
218             s$63 = Py.newString("Act as if n calls to random() were made, but quickly.\012\012        n is an int, greater than or equal to 0.\012\012        Example use:  If you have 2 threads and know that each will\012        consume no more than a million random numbers, create two Random\012        objects r1 and r2, then do\012            r2.setstate(r1.getstate())\012            r2.jumpahead(1000000)\012        Then r1 and r2 will use guaranteed-disjoint segments of the full\012        period.\012        ");
219             s$64 = Py.newString("n must be >= 0");
220             s$65 = Py.newString("Set the Wichmann-Hill seed from (x, y, z).\012\012        These must be integers in the range [0, 256).\012        ");
221             s$66 = Py.newString("seeds must be integers");
222             s$67 = Py.newString("seeds must be in range(0, 256)");
223             i$68 = Py.newInteger(16777215);
224             i$69 = Py.newInteger(24);
225             s$70 = Py.newString("Seed from hashable object's hash code.\012\012        None or no argument seeds from current time.  It is not guaranteed\012        that objects with distinct hash codes lead to distinct internal\012        states.\012\012        This is obsolete, provided for compatibility with the seed routine\012        used prior to Python 2.1.  Use the .seed() method instead.\012        ");
226             s$71 = Py.newString("Choose a random item from range(start, stop[, step]).\012\012        This fixes the problem with randint() which includes the\012        endpoint; in Python this is usually not what you want.\012        Do not supply the 'int' and 'default' arguments.\012        ");
227             s$72 = Py.newString("non-integer arg 1 for randrange()");
228             s$73 = Py.newString("empty range for randrange()");
229             s$74 = Py.newString("non-integer stop for randrange()");
230             s$75 = Py.newString("non-integer step for randrange()");
231             s$76 = Py.newString("zero step for randrange()");
232             s$77 = Py.newString("Return random integer in range [a, b], including both end points.\012\012        (Deprecated; use randrange(a, b+1).)\012        ");
233             s$78 = Py.newString("Choose a random element from a non-empty sequence.");
234             s$79 = Py.newString("x, random=random.random -> shuffle list x in place; return None.\012\012        Optional arg random is a 0-argument function returning a random\012        float in [0.0, 1.0); by default, the standard random.random.\012\012        Note that for even rather small len(x), the total number of\012        permutations of x is larger than the period of most random number\012        generators; this implies that \"most\" permutations of a long\012        sequence can never be generated.\012        ");
235             s$80 = Py.newString("Get a random number in the range [a, b).");
236             f$81 = Py.newFloat(1.0E-6);
237             f$82 = Py.newFloat(0.0);
238             s$83 = Py.newString("stdgamma: alpha must be > 0.0");
239             s$84 = Py.newString("times");
240             s$85 = Py.newString("eval");
241             f$86 = Py.newFloat(1.0E10);
242             s$87 = Py.newString("sec,");
243             s$88 = Py.newString("avg %g, stddev %g, min %g, max %g");
244             s$89 = Py.newString("TWOPI         =");
245             s$90 = Py.newString("LOG4          =");
246             s$91 = Py.newString("NV_MAGICCONST =");
247             s$92 = Py.newString("SG_MAGICCONST =");
248             s$93 = Py.newString("random()");
249             s$94 = Py.newString("normalvariate(0.0, 1.0)");
250             s$95 = Py.newString("lognormvariate(0.0, 1.0)");
251             s$96 = Py.newString("cunifvariate(0.0, 1.0)");
252             s$97 = Py.newString("expovariate(1.0)");
253             s$98 = Py.newString("vonmisesvariate(0.0, 1.0)");
254             s$99 = Py.newString("gammavariate(0.5, 1.0)");
255             s$100 = Py.newString("gammavariate(0.9, 1.0)");
256             s$101 = Py.newString("gammavariate(1.0, 1.0)");
257             s$102 = Py.newString("gammavariate(2.0, 1.0)");
258             s$103 = Py.newString("gammavariate(20.0, 1.0)");
259             s$104 = Py.newString("gammavariate(200.0, 1.0)");
260             s$105 = Py.newString("gauss(0.0, 1.0)");
261             s$106 = Py.newString("betavariate(3.0, 3.0)");
262             s$107 = Py.newString("paretovariate(1.0)");
263             s$108 = Py.newString("weibullvariate(1.0, 1.0)");
264             s$109 = Py.newString("jumpahead test failed ");
265             i$110 = Py.newInteger(200);
266             s$111 = Py.newString("__main__");
267             s$112 = Py.newString("/usr/share/jython/Lib/random.py");
268             funcTable = new _PyInner();
269             c$0__verify = Py.newCode(3, new String[] {"name", "computed", "expected"}, "/usr/share/jython/Lib/random.py", "_verify", false, false, funcTable, 0, null, null, 0, 1);
270             c$1___init__ = Py.newCode(2, new String[] {"self", "x"}, "/usr/share/jython/Lib/random.py", "__init__", false, false, funcTable, 1, null, null, 0, 1);
271             c$2_seed = Py.newCode(2, new String[] {"self", "a", "time", "z", "y", "x"}, "/usr/share/jython/Lib/random.py", "seed", false, false, funcTable, 2, null, null, 0, 1);
272             c$3_random = Py.newCode(1, new String[] {"self", "x", "z", "y"}, "/usr/share/jython/Lib/random.py", "random", false, false, funcTable, 3, null, null, 0, 1);
273             c$4_getstate = Py.newCode(1, new String[] {"self"}, "/usr/share/jython/Lib/random.py", "getstate", false, false, funcTable, 4, null, null, 0, 1);
274             c$5_setstate = Py.newCode(2, new String[] {"self", "state", "version"}, "/usr/share/jython/Lib/random.py", "setstate", false, false, funcTable, 5, null, null, 0, 1);
275             c$6_jumpahead = Py.newCode(2, new String[] {"self", "n", "x", "z", "y"}, "/usr/share/jython/Lib/random.py", "jumpahead", false, false, funcTable, 6, null, null, 0, 1);
276             c$7__Random__whseed = Py.newCode(4, new String[] {"self", "x", "y", "z", "time", "t"}, "/usr/share/jython/Lib/random.py", "_Random__whseed", false, false, funcTable, 7, null, null, 0, 1);
277             c$8_whseed = Py.newCode(2, new String[] {"self", "a", "x", "z", "y"}, "/usr/share/jython/Lib/random.py", "whseed", false, false, funcTable, 8, null, null, 0, 1);
278             c$9___getstate__ = Py.newCode(1, new String[] {"self"}, "/usr/share/jython/Lib/random.py", "__getstate__", false, false, funcTable, 9, null, null, 0, 1);
279             c$10___setstate__ = Py.newCode(2, new String[] {"self", "state"}, "/usr/share/jython/Lib/random.py", "__setstate__", false, false, funcTable, 10, null, null, 0, 1);
280             c$11_randrange = Py.newCode(6, new String[] {"self", "start", "stop", "step", "int", "default", "istep", "n", "istart", "istop"}, "/usr/share/jython/Lib/random.py", "randrange", false, false, funcTable, 11, null, null, 0, 1);
281             c$12_randint = Py.newCode(3, new String[] {"self", "a", "b"}, "/usr/share/jython/Lib/random.py", "randint", false, false, funcTable, 12, null, null, 0, 1);
282             c$13_choice = Py.newCode(2, new String[] {"self", "seq"}, "/usr/share/jython/Lib/random.py", "choice", false, false, funcTable, 13, null, null, 0, 1);
283             c$14_shuffle = Py.newCode(4, new String[] {"self", "x", "random", "int", "j", "i"}, "/usr/share/jython/Lib/random.py", "shuffle", false, false, funcTable, 14, null, null, 0, 1);
284             c$15_uniform = Py.newCode(3, new String[] {"self", "a", "b"}, "/usr/share/jython/Lib/random.py", "uniform", false, false, funcTable, 15, null, null, 0, 1);
285             c$16_normalvariate = Py.newCode(3, new String[] {"self", "mu", "sigma", "u2", "u1", "random", "zz", "z"}, "/usr/share/jython/Lib/random.py", "normalvariate", false, false, funcTable, 16, null, null, 0, 1);
286             c$17_lognormvariate = Py.newCode(3, new String[] {"self", "mu", "sigma"}, "/usr/share/jython/Lib/random.py", "lognormvariate", false, false, funcTable, 17, null, null, 0, 1);
287             c$18_cunifvariate = Py.newCode(3, new String[] {"self", "mean", "arc"}, "/usr/share/jython/Lib/random.py", "cunifvariate", false, false, funcTable, 18, null, null, 0, 1);
288             c$19_expovariate = Py.newCode(2, new String[] {"self", "lambd", "u", "random"}, "/usr/share/jython/Lib/random.py", "expovariate", false, false, funcTable, 19, null, null, 0, 1);
289             c$20_vonmisesvariate = Py.newCode(3, new String[] {"self", "mu", "kappa", "random", "theta", "z", "r", "u3", "u2", "u1", "f", "c", "b", "a"}, "/usr/share/jython/Lib/random.py", "vonmisesvariate", false, false, funcTable, 20, null, null, 0, 1);
290             c$21_gammavariate = Py.newCode(3, new String[] {"self", "alpha", "beta", "ainv"}, "/usr/share/jython/Lib/random.py", "gammavariate", false, false, funcTable, 21, null, null, 0, 1);
291             c$22_stdgamma = Py.newCode(5, new String[] {"self", "alpha", "ainv", "bbb", "ccc", "random", "z", "x", "v", "u", "r", "p", "u2", "u1", "b"}, "/usr/share/jython/Lib/random.py", "stdgamma", false, false, funcTable, 22, null, null, 0, 1);
292             c$23_gauss = Py.newCode(3, new String[] {"self", "mu", "sigma", "x2pi", "random", "g2rad", "z"}, "/usr/share/jython/Lib/random.py", "gauss", false, false, funcTable, 23, null, null, 0, 1);
293             c$24_betavariate = Py.newCode(3, new String[] {"self", "alpha", "beta", "y"}, "/usr/share/jython/Lib/random.py", "betavariate", false, false, funcTable, 24, null, null, 0, 1);
294             c$25_paretovariate = Py.newCode(2, new String[] {"self", "alpha", "u"}, "/usr/share/jython/Lib/random.py", "paretovariate", false, false, funcTable, 25, null, null, 0, 1);
295             c$26_weibullvariate = Py.newCode(3, new String[] {"self", "alpha", "beta", "u"}, "/usr/share/jython/Lib/random.py", "weibullvariate", false, false, funcTable, 26, null, null, 0, 1);
296             c$27_Random = Py.newCode(0, new String[] {}, "/usr/share/jython/Lib/random.py", "Random", false, false, funcTable, 27, null, null, 0, 0);
297             c$28__test_generator = Py.newCode(2, new String[] {"n", "funccall", "smallest", "code", "sum", "largest", "time", "x", "t1", "t0", "avg", "i", "stddev", "sqsum"}, "/usr/share/jython/Lib/random.py", "_test_generator", false, false, funcTable, 28, null, null, 0, 1);
298             c$29__test = Py.newCode(1, new String[] {"N", "r2", "r1", "i", "s"}, "/usr/share/jython/Lib/random.py", "_test", false, false, funcTable, 29, null, null, 0, 1);
299             c$30_main = Py.newCode(0, new String[] {}, "/usr/share/jython/Lib/random.py", "main", false, false, funcTable, 30, null, null, 0, 0);
300         }
301         
302         
303         public PyCode getMain() {
304             if (c$30_main == null) _PyInner.initConstants();
305             return c$30_main;
306         }
307         
308         public PyObject call_function(int index, PyFrame frame) {
309             switch (index){
310                 case 0:
311                 return _PyInner._verify$1(frame);
312                 case 1:
313                 return _PyInner.__init__$2(frame);
314                 case 2:
315                 return _PyInner.seed$3(frame);
316                 case 3:
317                 return _PyInner.random$4(frame);
318                 case 4:
319                 return _PyInner.getstate$5(frame);
320                 case 5:
321                 return _PyInner.setstate$6(frame);
322                 case 6:
323                 return _PyInner.jumpahead$7(frame);
324                 case 7:
325                 return _PyInner._Random__whseed$8(frame);
326                 case 8:
327                 return _PyInner.whseed$9(frame);
328                 case 9:
329                 return _PyInner.__getstate__$10(frame);
330                 case 10:
331                 return _PyInner.__setstate__$11(frame);
332                 case 11:
333                 return _PyInner.randrange$12(frame);
334                 case 12:
335                 return _PyInner.randint$13(frame);
336                 case 13:
337                 return _PyInner.choice$14(frame);
338                 case 14:
339                 return _PyInner.shuffle$15(frame);
340                 case 15:
341                 return _PyInner.uniform$16(frame);
342                 case 16:
343                 return _PyInner.normalvariate$17(frame);
344                 case 17:
345                 return _PyInner.lognormvariate$18(frame);
346                 case 18:
347                 return _PyInner.cunifvariate$19(frame);
348                 case 19:
349                 return _PyInner.expovariate$20(frame);
350                 case 20:
351                 return _PyInner.vonmisesvariate$21(frame);
352                 case 21:
353                 return _PyInner.gammavariate$22(frame);
354                 case 22:
355                 return _PyInner.stdgamma$23(frame);
356                 case 23:
357                 return _PyInner.gauss$24(frame);
358                 case 24:
359                 return _PyInner.betavariate$25(frame);
360                 case 25:
361                 return _PyInner.paretovariate$26(frame);
362                 case 26:
363                 return _PyInner.weibullvariate$27(frame);
364                 case 27:
365                 return _PyInner.Random$28(frame);
366                 case 28:
367                 return _PyInner._test_generator$29(frame);
368                 case 29:
369                 return _PyInner._test$30(frame);
370                 case 30:
371                 return _PyInner.main$31(frame);
372                 default:
373                 return null;
374             }
375         }
376         
377         private static PyObject _verify$1(PyFrame frame) {
378             if (frame.getglobal("abs").__call__(frame.getlocal(1)._sub(frame.getlocal(2)))._gt(f$24).__nonzero__()) {
379                 throw Py.makeException(frame.getglobal("ValueError").__call__(s$25._mod(new PyTuple(new PyObject[] {frame.getlocal(0), frame.getlocal(1), frame.getlocal(2)}))));
380             }
381             return Py.None;
382         }
383         
384         private static PyObject __init__$2(PyFrame frame) {
385             /* Initialize an instance.
386             
387                     Optional argument x controls seeding, as for Random.seed().
388                      */
389             frame.getlocal(0).invoke("seed", frame.getlocal(1));
390             frame.getlocal(0).__setattr__("gauss_next", frame.getglobal("None"));
391             return Py.None;
392         }
393         
394         private static PyObject seed$3(PyFrame frame) {
395             // Temporary Variables
396             PyObject[] t$0$PyObject__;
397             
398             // Code
399             /* Initialize internal state from hashable object.
400             
401                     None or no argument seeds from current time.
402             
403                     If a is not None or an int or long, hash(a) is used instead.
404             
405                     If a is an int or long, a is used directly.  Distinct values between
406                     0 and 27814431486575L inclusive are guaranteed to yield distinct
407                     internal states (this guarantee is specific to the default
408                     Wichmann-Hill generator).
409                      */
410             if (frame.getlocal(1)._is(frame.getglobal("None")).__nonzero__()) {
411                 frame.setlocal(2, org.python.core.imp.importOne("time", frame));
412                 frame.setlocal(1, frame.getglobal("long").__call__(frame.getlocal(2).__getattr__("time").__call__()._mul(i$43)));
413             }
414             if (frame.getglobal("type").__call__(frame.getlocal(1))._notin(new PyTuple(new PyObject[] {frame.getglobal("type").__call__(i$44), frame.getglobal("type").__call__(l$45)})).__nonzero__()) {
415                 frame.setlocal(1, frame.getglobal("hash").__call__(frame.getlocal(1)));
416             }
417             t$0$PyObject__ = org.python.core.Py.unpackSequence(frame.getglobal("divmod").__call__(frame.getlocal(1), i$46), 2);
418             frame.setlocal(1, t$0$PyObject__[0]);
419             frame.setlocal(5, t$0$PyObject__[1]);
420             t$0$PyObject__ = org.python.core.Py.unpackSequence(frame.getglobal("divmod").__call__(frame.getlocal(1), i$47), 2);
421             frame.setlocal(1, t$0$PyObject__[0]);
422             frame.setlocal(4, t$0$PyObject__[1]);
423             t$0$PyObject__ = org.python.core.Py.unpackSequence(frame.getglobal("divmod").__call__(frame.getlocal(1), i$48), 2);
424             frame.setlocal(1, t$0$PyObject__[0]);
425             frame.setlocal(3, t$0$PyObject__[1]);
426             frame.getlocal(0).__setattr__("_seed", new PyTuple(new PyObject[] {frame.getglobal("int").__call__(frame.getlocal(5))._add(i$40), frame.getglobal("int").__call__(frame.getlocal(4))._add(i$40), frame.getglobal("int").__call__(frame.getlocal(3))._add(i$40)}));
427             return Py.None;
428         }
429         
430         private static PyObject random$4(PyFrame frame) {
431             // Temporary Variables
432             PyObject[] t$0$PyObject__;
433             
434             // Code
435             /* Get the next random number in the range [0.0, 1.0). */
436             t$0$PyObject__ = org.python.core.Py.unpackSequence(frame.getlocal(0).__getattr__("_seed"), 3);
437             frame.setlocal(1, t$0$PyObject__[0]);
438             frame.setlocal(3, t$0$PyObject__[1]);
439             frame.setlocal(2, t$0$PyObject__[2]);
440             frame.setlocal(1, i$50._mul(frame.getlocal(1))._mod(i$51));
441             frame.setlocal(3, i$52._mul(frame.getlocal(3))._mod(i$53));
442             frame.setlocal(2, i$54._mul(frame.getlocal(2))._mod(i$55));
443             frame.getlocal(0).__setattr__("_seed", new PyTuple(new PyObject[] {frame.getlocal(1), frame.getlocal(3), frame.getlocal(2)}));
444             return frame.getlocal(1)._div(f$56)._add(frame.getlocal(3)._div(f$57))._add(frame.getlocal(2)._div(f$58))._mod(f$36);
445         }
446         
447         private static PyObject getstate$5(PyFrame frame) {
448             /* Return internal state; can be passed to setstate() later. */
449             return new PyTuple(new PyObject[] {frame.getlocal(0).__getattr__("VERSION"), frame.getlocal(0).__getattr__("_seed"), frame.getlocal(0).__getattr__("gauss_next")});
450         }
451         
452         private static PyObject setstate$6(PyFrame frame) {
453             // Temporary Variables
454             PyObject[] t$0$PyObject__;
455             
456             // Code
457             /* Restore internal state from object returned by getstate(). */
458             frame.setlocal(2, frame.getlocal(1).__getitem__(i$61));
459             if (frame.getlocal(2)._eq(i$40).__nonzero__()) {
460                 t$0$PyObject__ = org.python.core.Py.unpackSequence(frame.getlocal(1), 3);
461                 frame.setlocal(2, t$0$PyObject__[0]);
462                 frame.getlocal(0).__setattr__("_seed", t$0$PyObject__[1]);
463                 frame.getlocal(0).__setattr__("gauss_next", t$0$PyObject__[2]);
464             }
465             else {
466                 throw Py.makeException(frame.getglobal("ValueError").__call__(s$62._mod(new PyTuple(new PyObject[] {frame.getlocal(2), frame.getlocal(0).__getattr__("VERSION")}))));
467             }
468             return Py.None;
469         }
470         
471         private static PyObject jumpahead$7(PyFrame frame) {
472             // Temporary Variables
473             PyObject[] t$0$PyObject__;
474             
475             // Code
476             /* Act as if n calls to random() were made, but quickly.
477             
478                     n is an int, greater than or equal to 0.
479             
480                     Example use:  If you have 2 threads and know that each will
481                     consume no more than a million random numbers, create two Random
482                     objects r1 and r2, then do
483                         r2.setstate(r1.getstate())
484                         r2.jumpahead(1000000)
485                     Then r1 and r2 will use guaranteed-disjoint segments of the full
486                     period.
487                      */
488             if (frame.getlocal(1)._ge(i$61).__not__().__nonzero__()) {
489                 throw Py.makeException(frame.getglobal("ValueError").__call__(s$64));
490             }
491             t$0$PyObject__ = org.python.core.Py.unpackSequence(frame.getlocal(0).__getattr__("_seed"), 3);
492             frame.setlocal(2, t$0$PyObject__[0]);
493             frame.setlocal(4, t$0$PyObject__[1]);
494             frame.setlocal(3, t$0$PyObject__[2]);
495             frame.setlocal(2, frame.getglobal("int").__call__(frame.getlocal(2)._mul(frame.getglobal("pow").__call__(i$50, frame.getlocal(1), i$51)))._mod(i$51));
496             frame.setlocal(4, frame.getglobal("int").__call__(frame.getlocal(4)._mul(frame.getglobal("pow").__call__(i$52, frame.getlocal(1), i$53)))._mod(i$53));
497             frame.setlocal(3, frame.getglobal("int").__call__(frame.getlocal(3)._mul(frame.getglobal("pow").__call__(i$54, frame.getlocal(1), i$55)))._mod(i$55));
498             frame.getlocal(0).__setattr__("_seed", new PyTuple(new PyObject[] {frame.getlocal(2), frame.getlocal(4), frame.getlocal(3)}));
499             return Py.None;
500         }
501         
502         private static PyObject _Random__whseed$8(PyFrame frame) {
503             // Temporary Variables
504             PyObject[] t$0$PyObject__;
505             PyObject t$0$PyObject, t$1$PyObject, t$2$PyObject;
506             
507             // Code
508             /* Set the Wichmann-Hill seed from (x, y, z).
509             
510                     These must be integers in the range [0, 256).
511                      */
512             if ((frame.getglobal("type").__call__(frame.getlocal(1))._eq(t$0$PyObject = frame.getglobal("type").__call__(frame.getlocal(2))).__nonzero__() ? (t$0$PyObject._eq(t$1$PyObject = frame.getglobal("type").__call__(frame.getlocal(3))).__nonzero__() ? t$1$PyObject._eq(frame.getglobal("type").__call__(i$61)) : Py.Zero) : Py.Zero).__not__().__nonzero__()) {
513                 throw Py.makeException(frame.getglobal("TypeError").__call__(s$66));
514             }
515             if (((t$0$PyObject = ((t$1$PyObject = (i$61._le(t$2$PyObject = frame.getlocal(1)).__nonzero__() ? t$2$PyObject._lt(i$43) : Py.Zero)).__nonzero__() ? (i$61._le(t$2$PyObject = frame.getlocal(2)).__nonzero__() ? t$2$PyObject._lt(i$43) : Py.Zero) : t$1$PyObject)).__nonzero__() ? (i$61._le(t$1$PyObject = frame.getlocal(3)).__nonzero__() ? t$1$PyObject._lt(i$43) : Py.Zero) : t$0$PyObject).__not__().__nonzero__()) {
516                 throw Py.makeException(frame.getglobal("ValueError").__call__(s$67));
517             }
518             if ((i$61._eq(t$0$PyObject = frame.getlocal(1)).__nonzero__() ? (t$0$PyObject._eq(t$1$PyObject = frame.getlocal(2)).__nonzero__() ? t$1$PyObject._eq(frame.getlocal(3)) : Py.Zero) : Py.Zero).__nonzero__()) {
519                 frame.setlocal(4, org.python.core.imp.importOne("time", frame));
520                 frame.setlocal(5, frame.getglobal("long").__call__(frame.getlocal(4).__getattr__("time").__call__()._mul(i$43)));
521                 frame.setlocal(5, frame.getglobal("int").__call__(frame.getlocal(5)._and(i$68)._xor(frame.getlocal(5)._rshift(i$69))));
522                 t$0$PyObject__ = org.python.core.Py.unpackSequence(frame.getglobal("divmod").__call__(frame.getlocal(5), i$43), 2);
523                 frame.setlocal(5, t$0$PyObject__[0]);
524                 frame.setlocal(1, t$0$PyObject__[1]);
525                 t$0$PyObject__ = org.python.core.Py.unpackSequence(frame.getglobal("divmod").__call__(frame.getlocal(5), i$43), 2);
526                 frame.setlocal(5, t$0$PyObject__[0]);
527                 frame.setlocal(2, t$0$PyObject__[1]);
528                 t$0$PyObject__ = org.python.core.Py.unpackSequence(frame.getglobal("divmod").__call__(frame.getlocal(5), i$43), 2);
529                 frame.setlocal(5, t$0$PyObject__[0]);
530                 frame.setlocal(3, t$0$PyObject__[1]);
531             }
532             frame.getlocal(0).__setattr__("_seed", new PyTuple(new PyObject[] {(t$0$PyObject = frame.getlocal(1)).__nonzero__() ? t$0$PyObject : i$40, (t$0$PyObject = frame.getlocal(2)).__nonzero__() ? t$0$PyObject : i$40, (t$0$PyObject = frame.getlocal(3)).__nonzero__() ? t$0$PyObject : i$40}));
533             return Py.None;
534         }
535         
536         private static PyObject whseed$9(PyFrame frame) {
537             // Temporary Variables
538             PyObject[] t$0$PyObject__;
539             PyObject t$0$PyObject;
540             
541             // Code
542             /* Seed from hashable object's hash code.
543             
544                     None or no argument seeds from current time.  It is not guaranteed
545                     that objects with distinct hash codes lead to distinct internal
546                     states.
547             
548                     This is obsolete, provided for compatibility with the seed routine
549                     used prior to Python 2.1.  Use the .seed() method instead.
550                      */
551             if (frame.getlocal(1)._is(frame.getglobal("None")).__nonzero__()) {
552                 frame.getlocal(0).invoke("_Random__whseed");
553                 return Py.None;
554             }
555             frame.setlocal(1, frame.getglobal("hash").__call__(frame.getlocal(1)));
556             t$0$PyObject__ = org.python.core.Py.unpackSequence(frame.getglobal("divmod").__call__(frame.getlocal(1), i$43), 2);
557             frame.setlocal(1, t$0$PyObject__[0]);
558             frame.setlocal(2, t$0$PyObject__[1]);
559             t$0$PyObject__ = org.python.core.Py.unpackSequence(frame.getglobal("divmod").__call__(frame.getlocal(1), i$43), 2);
560             frame.setlocal(1, t$0$PyObject__[0]);
561             frame.setlocal(4, t$0$PyObject__[1]);
562             t$0$PyObject__ = org.python.core.Py.unpackSequence(frame.getglobal("divmod").__call__(frame.getlocal(1), i$43), 2);
563             frame.setlocal(1, t$0$PyObject__[0]);
564             frame.setlocal(3, t$0$PyObject__[1]);
565             frame.setlocal(2, (t$0$PyObject = frame.getlocal(2)._add(frame.getlocal(1))._mod(i$43)).__nonzero__() ? t$0$PyObject : i$40);
566             frame.setlocal(4, (t$0$PyObject = frame.getlocal(4)._add(frame.getlocal(1))._mod(i$43)).__nonzero__() ? t$0$PyObject : i$40);
567             frame.setlocal(3, (t$0$PyObject = frame.getlocal(3)._add(frame.getlocal(1))._mod(i$43)).__nonzero__() ? t$0$PyObject : i$40);
568             frame.getlocal(0).invoke("_Random__whseed", new PyObject[] {frame.getlocal(2), frame.getlocal(4), frame.getlocal(3)});
569             return Py.None;
570         }
571         
572         private static PyObject __getstate__$10(PyFrame frame) {
573             return frame.getlocal(0).invoke("getstate");
574         }
575         
576         private static PyObject __setstate__$11(PyFrame frame) {
577             frame.getlocal(0).invoke("setstate", frame.getlocal(1));
578             return Py.None;
579         }
580         
581         private static PyObject randrange$12(PyFrame frame) {
582             /* Choose a random item from range(start, stop[, step]).
583             
584                     This fixes the problem with randint() which includes the
585                     endpoint; in Python this is usually not what you want.
586                     Do not supply the 'int' and 'default' arguments.
587                      */
588             frame.setlocal(8, frame.getlocal(4).__call__(frame.getlocal(1)));
589             if (frame.getlocal(8)._ne(frame.getlocal(1)).__nonzero__()) {
590                 throw Py.makeException(frame.getglobal("ValueError"), s$72);
591             }
592             if (frame.getlocal(2)._is(frame.getlocal(5)).__nonzero__()) {
593                 if (frame.getlocal(8)._gt(i$61).__nonzero__()) {
594                     return frame.getlocal(4).__call__(frame.getlocal(0).invoke("random")._mul(frame.getlocal(8)));
595                 }
596                 throw Py.makeException(frame.getglobal("ValueError"), s$73);
597             }
598             frame.setlocal(9, frame.getlocal(4).__call__(frame.getlocal(2)));
599             if (frame.getlocal(9)._ne(frame.getlocal(2)).__nonzero__()) {
600                 throw Py.makeException(frame.getglobal("ValueError"), s$74);
601             }
602             if (frame.getlocal(3)._eq(i$40).__nonzero__()) {
603                 if (frame.getlocal(8)._lt(frame.getlocal(9)).__nonzero__()) {
604                     return frame.getlocal(8)._add(frame.getlocal(4).__call__(frame.getlocal(0).invoke("random")._mul(frame.getlocal(9)._sub(frame.getlocal(8)))));
605                 }
606                 throw Py.makeException(frame.getglobal("ValueError"), s$73);
607             }
608             frame.setlocal(6, frame.getlocal(4).__call__(frame.getlocal(3)));
609             if (frame.getlocal(6)._ne(frame.getlocal(3)).__nonzero__()) {
610                 throw Py.makeException(frame.getglobal("ValueError"), s$75);
611             }
612             if (frame.getlocal(6)._gt(i$61).__nonzero__()) {
613                 frame.setlocal(7, frame.getlocal(9)._sub(frame.getlocal(8))._add(frame.getlocal(6))._sub(i$40)._div(frame.getlocal(6)));
614             }
615             else if (frame.getlocal(6)._lt(i$61).__nonzero__()) {
616                 frame.setlocal(7, frame.getlocal(9)._sub(frame.getlocal(8))._add(frame.getlocal(6))._add(i$40)._div(frame.getlocal(6)));
617             }
618             else {
619                 throw Py.makeException(frame.getglobal("ValueError"), s$76);
620             }
621             if (frame.getlocal(7)._le(i$61).__nonzero__()) {
622                 throw Py.makeException(frame.getglobal("ValueError"), s$73);
623             }
624             return frame.getlocal(8)._add(frame.getlocal(6)._mul(frame.getlocal(4).__call__(frame.getlocal(0).invoke("random")._mul(frame.getlocal(7)))));
625         }
626         
627         private static PyObject randint$13(PyFrame frame) {
628             /* Return random integer in range [a, b], including both end points.
629             
630                     (Deprecated; use randrange(a, b+1).)
631                      */
632             return frame.getlocal(0).invoke("randrange", frame.getlocal(1), frame.getlocal(2)._add(i$40));
633         }
634         
635         private static PyObject choice$14(PyFrame frame) {
636             /* Choose a random element from a non-empty sequence. */
637             return frame.getlocal(1).__getitem__(frame.getglobal("int").__call__(frame.getlocal(0).invoke("random")._mul(frame.getglobal("len").__call__(frame.getlocal(1)))));
638         }
639         
640         private static PyObject shuffle$15(PyFrame frame) {
641             // Temporary Variables
642             int t$0$int;
643             PyObject[] t$0$PyObject__;
644             PyObject t$0$PyObject, t$1$PyObject;
645             
646             // Code
647             /* x, random=random.random -> shuffle list x in place; return None.
648             
649                     Optional arg random is a 0-argument function returning a random
650                     float in [0.0, 1.0); by default, the standard random.random.
651             
652                     Note that for even rather small len(x), the total number of
653                     permutations of x is larger than the period of most random number
654                     generators; this implies that "most" permutations of a long
655                     sequence can never be generated.
656                      */
657             if (frame.getlocal(2)._is(frame.getglobal("None")).__nonzero__()) {
658                 frame.setlocal(2, frame.getlocal(0).__getattr__("random"));
659             }
660             t$0$int = 0;
661             t$1$PyObject = frame.getglobal("xrange").__call__(frame.getglobal("len").__call__(frame.getlocal(1))._sub(i$40), i$61, i$40.__neg__());
662             while ((t$0$PyObject = t$1$PyObject.__finditem__(t$0$int++)) != null) {
663                 frame.setlocal(5, t$0$PyObject);
664                 frame.setlocal(4, frame.getlocal(3).__call__(frame.getlocal(2).__call__()._mul(frame.getlocal(5)._add(i$40))));
665                 t$0$PyObject__ = org.python.core.Py.unpackSequence(new PyTuple(new PyObject[] {frame.getlocal(1).__getitem__(frame.getlocal(4)), frame.getlocal(1).__getitem__(frame.getlocal(5))}), 2);
666                 frame.getlocal(1).__setitem__(frame.getlocal(5), t$0$PyObject__[0]);
667                 frame.getlocal(1).__setitem__(frame.getlocal(4), t$0$PyObject__[1]);
668             }
669             return Py.None;
670         }
671         
672         private static PyObject uniform$16(PyFrame frame) {
673             /* Get a random number in the range [a, b). */
674             return frame.getlocal(1)._add(frame.getlocal(2)._sub(frame.getlocal(1))._mul(frame.getlocal(0).invoke("random")));
675         }
676         
677         private static PyObject normalvariate$17(PyFrame frame) {
678             frame.setlocal(5, frame.getlocal(0).__getattr__("random"));
679             while (i$40.__nonzero__()) {
680                 frame.setlocal(4, frame.getlocal(5).__call__());
681                 frame.setlocal(3, frame.getlocal(5).__call__());
682                 frame.setlocal(7, frame.getglobal("NV_MAGICCONST")._mul(frame.getlocal(4)._sub(f$27))._div(frame.getlocal(3)));
683                 frame.setlocal(6, frame.getlocal(7)._mul(frame.getlocal(7))._div(f$33));
684                 if (frame.getlocal(6)._le(frame.getglobal("_log").__call__(frame.getlocal(3)).__neg__()).__nonzero__()) {
685                     break;
686                 }
687             }
688             return frame.getlocal(1)._add(frame.getlocal(7)._mul(frame.getlocal(2)));
689         }
690         
691         private static PyObject lognormvariate$18(PyFrame frame) {
692             return frame.getglobal("_exp").__call__(frame.getlocal(0).invoke("normalvariate", frame.getlocal(1), frame.getlocal(2)));
693         }
694         
695         private static PyObject cunifvariate$19(PyFrame frame) {
696             return frame.getlocal(1)._add(frame.getlocal(2)._mul(frame.getlocal(0).invoke("random")._sub(f$27)))._mod(frame.getglobal("_pi"));
697         }
698         
699         private static PyObject expovariate$20(PyFrame frame) {
700             frame.setlocal(3, frame.getlocal(0).__getattr__("random"));
701             frame.setlocal(2, frame.getlocal(3).__call__());
702             while (frame.getlocal(2)._le(f$24).__nonzero__()) {
703                 frame.setlocal(2, frame.getlocal(3).__call__());
704             }
705             return frame.getglobal("_log").__call__(frame.getlocal(2)).__neg__()._div(frame.getlocal(1));
706         }
707         
708         private static PyObject vonmisesvariate$21(PyFrame frame) {
709             // Temporary Variables
710             PyObject t$0$PyObject;
711             
712             // Code
713             frame.setlocal(3, frame.getlocal(0).__getattr__("random"));
714             if (frame.getlocal(2)._le(f$81).__nonzero__()) {
715                 return frame.getglobal("TWOPI")._mul(frame.getlocal(3).__call__());
716             }
717             frame.setlocal(13, f$36._add(frame.getglobal("_sqrt").__call__(f$36._add(f$33._mul(frame.getlocal(2))._mul(frame.getlocal(2))))));
718             frame.setlocal(12, frame.getlocal(13)._sub(frame.getglobal("_sqrt").__call__(f$28._mul(frame.getlocal(13))))._div(f$28._mul(frame.getlocal(2))));
719             frame.setlocal(6, f$36._add(frame.getlocal(12)._mul(frame.getlocal(12)))._div(f$28._mul(frame.getlocal(12))));
720             while (i$40.__nonzero__()) {
721                 frame.setlocal(9, frame.getlocal(3).__call__());
722                 frame.setlocal(5, frame.getglobal("_cos").__call__(frame.getglobal("_pi")._mul(frame.getlocal(9))));
723                 frame.setlocal(10, f$36._add(frame.getlocal(6)._mul(frame.getlocal(5)))._div(frame.getlocal(6)._add(frame.getlocal(5))));
724                 frame.setlocal(11, frame.getlocal(2)._mul(frame.getlocal(6)._sub(frame.getlocal(10))));
725                 frame.setlocal(8, frame.getlocal(3).__call__());
726                 if (((t$0$PyObject = frame.getlocal(8)._ge(frame.getlocal(11)._mul(f$28._sub(frame.getlocal(11))))).__nonzero__() ? frame.getlocal(8)._gt(frame.getlocal(11)._mul(frame.getglobal("_exp").__call__(f$36._sub(frame.getlocal(11))))) : t$0$PyObject).__not__().__nonzero__()) {
727                     break;
728                 }
729             }
730             frame.setlocal(7, frame.getlocal(3).__call__());
731             if (frame.getlocal(7)._gt(f$27).__nonzero__()) {
732                 frame.setlocal(4, frame.getlocal(1)._mod(frame.getglobal("TWOPI"))._add(frame.getglobal("_acos").__call__(frame.getlocal(10))));
733             }
734             else {
735                 frame.setlocal(4, frame.getlocal(1)._mod(frame.getglobal("TWOPI"))._sub(frame.getglobal("_acos").__call__(frame.getlocal(10))));
736             }
737             return frame.getlocal(4);
738         }
739         
740         private static PyObject gammavariate$22(PyFrame frame) {
741             frame.setlocal(3, frame.getglobal("_sqrt").__call__(f$28._mul(frame.getlocal(1))._sub(f$36)));
742             return frame.getlocal(2)._mul(frame.getlocal(0).invoke("stdgamma", new PyObject[] {frame.getlocal(1), frame.getlocal(3), frame.getlocal(1)._sub(frame.getglobal("LOG4")), frame.getlocal(1)._add(frame.getlocal(3))}));
743         }
744         
745         private static PyObject stdgamma$23(PyFrame frame) {
746             // Temporary Variables
747             PyObject t$0$PyObject, t$1$PyObject;
748             
749             // Code
750             frame.setlocal(5, frame.getlocal(0).__getattr__("random"));
751             if (frame.getlocal(1)._le(f$82).__nonzero__()) {
752                 throw Py.makeException(frame.getglobal("ValueError"), s$83);
753             }
754             if (frame.getlocal(1)._gt(f$36).__nonzero__()) {
755                 while (i$40.__nonzero__()) {
756                     frame.setlocal(13, frame.getlocal(5).__call__());
757                     frame.setlocal(12, frame.getlocal(5).__call__());
758                     frame.setlocal(8, frame.getglobal("_log").__call__(frame.getlocal(13)._div(f$36._sub(frame.getlocal(13))))._div(frame.getlocal(2)));
759                     frame.setlocal(7, frame.getlocal(1)._mul(frame.getglobal("_exp").__call__(frame.getlocal(8))));
760                     frame.setlocal(6, frame.getlocal(13)._mul(frame.getlocal(13))._mul(frame.getlocal(12)));
761                     frame.setlocal(10, frame.getlocal(3)._add(frame.getlocal(4)._mul(frame.getlocal(8)))._sub(frame.getlocal(7)));
762                     if (((t$0$PyObject = frame.getlocal(10)._add(frame.getglobal("SG_MAGICCONST"))._sub(f$37._mul(frame.getlocal(6)))._ge(f$82)).__nonzero__() ? t$0$PyObject : frame.getlocal(10)._ge(frame.getglobal("_log").__call__(frame.getlocal(6)))).__nonzero__()) {
763                         return frame.getlocal(7);
764                     }
765                 }
766             }
767             else if (frame.getlocal(1)._eq(f$36).__nonzero__()) {
768                 frame.setlocal(9, frame.getlocal(5).__call__());
769                 while (frame.getlocal(9)._le(f$24).__nonzero__()) {
770                     frame.setlocal(9, frame.getlocal(5).__call__());
771                 }
772                 return frame.getglobal("_log").__call__(frame.getlocal(9)).__neg__();
773             }
774             else {
775                 while (i$40.__nonzero__()) {
776                     frame.setlocal(9, frame.getlocal(5).__call__());
777                     frame.setlocal(14, frame.getglobal("_e")._add(frame.getlocal(1))._div(frame.getglobal("_e")));
778                     frame.setlocal(11, frame.getlocal(14)._mul(frame.getlocal(9)));
779                     if (frame.getlocal(11)._le(f$36).__nonzero__()) {
780                         frame.setlocal(7, frame.getglobal("pow").__call__(frame.getlocal(11), f$36._div(frame.getlocal(1))));
781                     }
782                     else {
783                         frame.setlocal(7, frame.getglobal("_log").__call__(frame.getlocal(14)._sub(frame.getlocal(11))._div(frame.getlocal(1))).__neg__());
784                     }
785                     frame.setlocal(13, frame.getlocal(5).__call__());
786                     if (((t$0$PyObject = ((t$1$PyObject = frame.getlocal(11)._le(f$36)).__nonzero__() ? frame.getlocal(13)._gt(frame.getglobal("_exp").__call__(frame.getlocal(7).__neg__())) : t$1$PyObject)).__nonzero__() ? t$0$PyObject : ((t$1$PyObject = frame.getlocal(11)._gt(i$40)).__nonzero__() ? frame.getlocal(13)._gt(frame.getglobal("pow").__call__(frame.getlocal(7), frame.getlocal(1)._sub(f$36))) : t$1$PyObject)).__not__().__nonzero__()) {
787                         break;
788                     }
789                 }
790                 return frame.getlocal(7);
791             }
792             return Py.None;
793         }
794         
795         private static PyObject gauss$24(PyFrame frame) {
796             frame.setlocal(4, frame.getlocal(0).__getattr__("random"));
797             frame.setlocal(6, frame.getlocal(0).__getattr__("gauss_next"));
798             frame.getlocal(0).__setattr__("gauss_next", frame.getglobal("None"));
799             if (frame.getlocal(6)._is(frame.getglobal("None")).__nonzero__()) {
800                 frame.setlocal(3, frame.getlocal(4).__call__()._mul(frame.getglobal("TWOPI")));
801                 frame.setlocal(5, frame.getglobal("_sqrt").__call__(f$28.__neg__()._mul(frame.getglobal("_log").__call__(f$36._sub(frame.getlocal(4).__call__())))));
802                 frame.setlocal(6, frame.getglobal("_cos").__call__(frame.getlocal(3))._mul(frame.getlocal(5)));
803                 frame.getlocal(0).__setattr__("gauss_next", frame.getglobal("_sin").__call__(frame.getlocal(3))._mul(frame.getlocal(5)));
804             }
805             return frame.getlocal(1)._add(frame.getlocal(6)._mul(frame.getlocal(2)));
806         }
807         
808         private static PyObject betavariate$25(PyFrame frame) {
809             frame.setlocal(3, frame.getlocal(0).invoke("gammavariate", frame.getlocal(1), f$36));
810             if (frame.getlocal(3)._eq(i$61).__nonzero__()) {
811                 return f$82;
812             }
813             else {
814                 return frame.getlocal(3)._div(frame.getlocal(3)._add(frame.getlocal(0).invoke("gammavariate", frame.getlocal(2), f$36)));
815             }
816         }
817         
818         private static PyObject paretovariate$26(PyFrame frame) {
819             frame.setlocal(2, frame.getlocal(0).invoke("random"));
820             return f$36._div(frame.getglobal("pow").__call__(frame.getlocal(2), f$36._div(frame.getlocal(1))));
821         }
822         
823         private static PyObject weibullvariate$27(PyFrame frame) {
824             frame.setlocal(3, frame.getlocal(0).invoke("random"));
825             return frame.getlocal(1)._mul(frame.getglobal("pow").__call__(frame.getglobal("_log").__call__(frame.getlocal(3)).__neg__(), f$36._div(frame.getlocal(2))));
826         }
827         
828         private static PyObject Random$28(PyFrame frame) {
829             frame.setlocal("VERSION", i$40);
830             frame.setlocal("__init__", new PyFunction(frame.f_globals, new PyObject[] {frame.getname("None")}, c$1___init__));
831             frame.setlocal("seed", new PyFunction(frame.f_globals, new PyObject[] {frame.getname("None")}, c$2_seed));
832             frame.setlocal("random", new PyFunction(frame.f_globals, new PyObject[] {}, c$3_random));
833             frame.setlocal("getstate", new PyFunction(frame.f_globals, new PyObject[] {}, c$4_getstate));
834             frame.setlocal("setstate", new PyFunction(frame.f_globals, new PyObject[] {}, c$5_setstate));
835             frame.setlocal("jumpahead", new PyFunction(frame.f_globals, new PyObject[] {}, c$6_jumpahead));
836             frame.setlocal("_Random__whseed", new PyFunction(frame.f_globals, new PyObject[] {i$61, i$61, i$61}, c$7__Random__whseed));
837             frame.setlocal("whseed", new PyFunction(frame.f_globals, new PyObject[] {frame.getname("None")}, c$8_whseed));
838             frame.setlocal("__getstate__", new PyFunction(frame.f_globals, new PyObject[] {}, c$9___getstate__));
839             frame.setlocal("__setstate__", new PyFunction(frame.f_globals, new PyObject[] {}, c$10___setstate__));
840             frame.setlocal("randrange", new PyFunction(frame.f_globals, new PyObject[] {frame.getname("None"), i$40, frame.getname("int"), frame.getname("None")}, c$11_randrange));
841             frame.setlocal("randint", new PyFunction(frame.f_globals, new PyObject[] {}, c$12_randint));
842             frame.setlocal("choice", new PyFunction(frame.f_globals, new PyObject[] {}, c$13_choice));
843             frame.setlocal("shuffle", new PyFunction(frame.f_globals, new PyObject[] {frame.getname("None"), frame.getname("int")}, c$14_shuffle));
844             frame.setlocal("uniform", new PyFunction(frame.f_globals, new PyObject[] {}, c$15_uniform));
845             frame.setlocal("normalvariate", new PyFunction(frame.f_globals, new PyObject[] {}, c$16_normalvariate));
846             frame.setlocal("lognormvariate", new PyFunction(frame.f_globals, new PyObject[] {}, c$17_lognormvariate));
847             frame.setlocal("cunifvariate", new PyFunction(frame.f_globals, new PyObject[] {}, c$18_cunifvariate));
848             frame.setlocal("expovariate", new PyFunction(frame.f_globals, new PyObject[] {}, c$19_expovariate));
849             frame.setlocal("vonmisesvariate", new PyFunction(frame.f_globals, new PyObject[] {}, c$20_vonmisesvariate));
850             frame.setlocal("gammavariate", new PyFunction(frame.f_globals, new PyObject[] {}, c$21_gammavariate));
851             frame.setlocal("stdgamma", new PyFunction(frame.f_globals, new PyObject[] {}, c$22_stdgamma));
852             frame.setlocal("gauss", new PyFunction(frame.f_globals, new PyObject[] {}, c$23_gauss));
853             frame.setlocal("betavariate", new PyFunction(frame.f_globals, new PyObject[] {}, c$24_betavariate));
854             frame.setlocal("paretovariate", new PyFunction(frame.f_globals, new PyObject[] {}, c$25_paretovariate));
855             frame.setlocal("weibullvariate", new PyFunction(frame.f_globals, new PyObject[] {}, c$26_weibullvariate));
856             return frame.getf_locals();
857         }
858         
859         private static PyObject _test_generator$29(PyFrame frame) {
860             // Temporary Variables
861             int t$0$int;
862             PyObject t$0$PyObject, t$1$PyObject;
863             
864             // Code
865             frame.setlocal(6, org.python.core.imp.importOne("time", frame));
866             Py.printComma(frame.getlocal(0));
867             Py.printComma(s$84);
868             Py.println(frame.getlocal(1));
869             frame.setlocal(3, frame.getglobal("compile").__call__(frame.getlocal(1), frame.getlocal(1), s$85));
870             frame.setlocal(4, f$82);
871             frame.setlocal(13, f$82);
872             frame.setlocal(2, f$86);
873             frame.setlocal(5, f$86.__neg__());
874             frame.setlocal(9, frame.getlocal(6).__getattr__("time").__call__());
875             t$0$int = 0;
876             t$1$PyObject = frame.getglobal("range").__call__(frame.getlocal(0));
877             while ((t$0$PyObject = t$1$PyObject.__finditem__(t$0$int++)) != null) {
878                 frame.setlocal(11, t$0$PyObject);
879                 frame.setlocal(7, frame.getglobal("eval").__call__(frame.getlocal(3)));
880                 frame.setlocal(4, frame.getlocal(4)._add(frame.getlocal(7)));
881                 frame.setlocal(13, frame.getlocal(13)._add(frame.getlocal(7)._mul(frame.getlocal(7))));
882                 frame.setlocal(2, frame.getglobal("min").__call__(frame.getlocal(7), frame.getlocal(2)));
883                 frame.setlocal(5, frame.getglobal("max").__call__(frame.getlocal(7), frame.getlocal(5)));
884             }
885             frame.setlocal(8, frame.getlocal(6).__getattr__("time").__call__());
886             Py.printComma(frame.getglobal("round").__call__(frame.getlocal(8)._sub(frame.getlocal(9)), i$44));
887             Py.printComma(s$87);
888             frame.setlocal(10, frame.getlocal(4)._div(frame.getlocal(0)));
889             frame.setlocal(12, frame.getglobal("_sqrt").__call__(frame.getlocal(13)._div(frame.getlocal(0))._sub(frame.getlocal(10)._mul(frame.getlocal(10)))));
890             Py.println(s$88._mod(new PyTuple(new PyObject[] {frame.getlocal(10), frame.getlocal(12), frame.getlocal(2), frame.getlocal(5)})));
891             return Py.None;
892         }
893         
894         private static PyObject _test$30(PyFrame frame) {
895             // Temporary Variables
896             int t$0$int;
897             PyObject t$0$PyObject, t$1$PyObject;
898             
899             // Code
900             Py.printComma(s$89);
901             Py.println(frame.getglobal("TWOPI"));
902             Py.printComma(s$90);
903             Py.println(frame.getglobal("LOG4"));
904             Py.printComma(s$91);
905             Py.println(frame.getglobal("NV_MAGICCONST"));
906             Py.printComma(s$92);
907             Py.println(frame.getglobal("SG_MAGICCONST"));
908             frame.getglobal("_test_generator").__call__(frame.getlocal(0), s$93);
909             frame.getglobal("_test_generator").__call__(frame.getlocal(0), s$94);
910             frame.getglobal("_test_generator").__call__(frame.getlocal(0), s$95);
911             frame.getglobal("_test_generator").__call__(frame.getlocal(0), s$96);
912             frame.getglobal("_test_generator").__call__(frame.getlocal(0), s$97);
913             frame.getglobal("_test_generator").__call__(frame.getlocal(0), s$98);
914             frame.getglobal("_test_generator").__call__(frame.getlocal(0), s$99);
915             frame.getglobal("_test_generator").__call__(frame.getlocal(0), s$100);
916             frame.getglobal("_test_generator").__call__(frame.getlocal(0), s$101);
917             frame.getglobal("_test_generator").__call__(frame.getlocal(0), s$102);
918             frame.getglobal("_test_generator").__call__(frame.getlocal(0), s$103);
919             frame.getglobal("_test_generator").__call__(frame.getlocal(0), s$104);
920             frame.getglobal("_test_generator").__call__(frame.getlocal(0), s$105);
921             frame.getglobal("_test_generator").__call__(frame.getlocal(0), s$106);
922             frame.getglobal("_test_generator").__call__(frame.getlocal(0), s$107);
923             frame.getglobal("_test_generator").__call__(frame.getlocal(0), s$108);
924             frame.setlocal(4, frame.getglobal("getstate").__call__());
925             frame.getglobal("jumpahead").__call__(frame.getlocal(0));
926             frame.setlocal(2, frame.getglobal("random").__call__());
927             frame.getglobal("setstate").__call__(frame.getlocal(4));
928             t$0$int = 0;
929             t$1$PyObject = frame.getglobal("range").__call__(frame.getlocal(0));
930             while ((t$0$PyObject = t$1$PyObject.__finditem__(t$0$int++)) != null) {
931                 frame.setlocal(3, t$0$PyObject);
932                 frame.getglobal("random").__call__();
933             }
934             frame.setlocal(1, frame.getglobal("random").__call__());
935             if (frame.getlocal(2)._ne(frame.getlocal(1)).__nonzero__()) {
936                 throw Py.makeException(frame.getglobal("ValueError").__call__(s$109._add(new PyTuple(new PyObject[] {frame.getlocal(0), frame.getlocal(2), frame.getlocal(1)}).__repr__())));
937             }
938             return Py.None;
939         }
940         
941         private static PyObject main$31(PyFrame frame) {
942             frame.setglobal("__file__", s$112);
943             
944             PyObject[] imp_accu;
945             // Code
946             /* Random variable generators.
947             
948                 integers
949                 --------
950                        uniform within range
951             
952                 sequences
953                 ---------
954                        pick random element
955                        generate random permutation
956             
957                 distributions on the real line:
958                 ------------------------------
959                        uniform
960                        normal (Gaussian)
961                        lognormal
962                        negative exponential
963                        gamma
964                        beta
965             
966                 distributions on the circle (angles 0 to 2pi)
967                 ---------------------------------------------
968                        circular uniform
969                        von Mises
970             
971             Translated from anonymously contributed C/C++ source.
972             
973             Multi-threading note:  the random number generator used here is not thread-
974             safe; it is possible that two calls return the same random value.  However,
975             you can instantiate a different instance of Random() in each thread to get
976             generators that don't share state, then use .setstate() and .jumpahead() to
977             move the generators to disjoint segments of the full period.  For example,
978             
979             def create_generators(num, delta, firstseed=None):
980                 """Return list of num distinct generators.
981                 Each generator has its own unique segment of delta elements from
982                 Random.random()'s full period.
983                 Seed the first generator with optional arg firstseed (default is
984                 None, to seed from current time).
985                 """
986             
987                 from random import Random
988                 g = Random(firstseed)
989                 result = [g]
990                 for i in range(num - 1):
991                     laststate = g.getstate()
992                     g = Random()
993                     g.setstate(laststate)
994                     g.jumpahead(delta)
995                     result.append(g)
996                 return result
997             
998             gens = create_generators(10, 1000000)
999             
1000             That creates 10 distinct generators, which can be passed out to 10 distinct
1001             threads.  The generators don't share state so can be called safely in
1002             parallel.  So long as no thread calls its g.random() more than a million
1003             times (the second argument to create_generators), the sequences seen by
1004             each thread will not overlap.
1005             
1006             The period of the underlying Wichmann-Hill generator is 6,953,607,871,644,
1007             and that limits how far this technique can be pushed.
1008             
1009             Just for fun, note that since we know the period, .jumpahead() can also be
1010             used to "move backward in time":
1011             
1012             >>> g = Random(42)  # arbitrary
1013             >>> g.random()
1014             0.25420336316883324
1015             >>> g.jumpahead(6953607871644L - 1) # move *back* one
1016             >>> g.random()
1017             0.25420336316883324
1018              */
1019             imp_accu = org.python.core.imp.importFrom("math", new String[] {"log", "exp", "pi", "e"}, frame);
1020             frame.setlocal("_log", imp_accu[0]);
1021             frame.setlocal("_exp", imp_accu[1]);
1022             frame.setlocal("_pi", imp_accu[2]);
1023             frame.setlocal("_e", imp_accu[3]);
1024             imp_accu = null;
1025             imp_accu = org.python.core.imp.importFrom("math", new String[] {"sqrt", "acos", "cos", "sin"}, frame);
1026             frame.setlocal("_sqrt", imp_accu[0]);
1027             frame.setlocal("_acos", imp_accu[1]);
1028             frame.setlocal("_cos", imp_accu[2]);
1029             frame.setlocal("_sin", imp_accu[3]);
1030             imp_accu = null;
1031             frame.setlocal("__all__", new PyList(new PyObject[] {s$1, s$2, s$3, s$4, s$5, s$6, s$7, s$8, s$9, s$10, s$11, s$12, s$13, s$14, s$15, s$16, s$17, s$18, s$19, s$20, s$21, s$22, s$23}));
1032             frame.setlocal("_verify", new PyFunction(frame.f_globals, new PyObject[] {}, c$0__verify));
1033             frame.setlocal("NV_MAGICCONST", i$26._mul(frame.getname("_exp").__call__(f$27.__neg__()))._div(frame.getname("_sqrt").__call__(f$28)));
1034             frame.getname("_verify").__call__(s$29, frame.getname("NV_MAGICCONST"), f$30);
1035             frame.setlocal("TWOPI", f$28._mul(frame.getname("_pi")));
1036             frame.getname("_verify").__call__(s$31, frame.getname("TWOPI"), f$32);
1037             frame.setlocal("LOG4", frame.getname("_log").__call__(f$33));
1038             frame.getname("_verify").__call__(s$34, frame.getname("LOG4"), f$35);
1039             frame.setlocal("SG_MAGICCONST", f$36._add(frame.getname("_log").__call__(f$37)));
1040             frame.getname("_verify").__call__(s$38, frame.getname("SG_MAGICCONST"), f$39);
1041             frame.dellocal("_verify");
1042             frame.setlocal("Random", Py.makeClass("Random", new PyObject[] {}, c$27_Random, null));
1043             frame.setlocal("_test_generator", new PyFunction(frame.f_globals, new PyObject[] {}, c$28__test_generator));
1044             frame.setlocal("_test", new PyFunction(frame.f_globals, new PyObject[] {i$110}, c$29__test));
1045             frame.setlocal("_inst", frame.getname("Random").__call__());
1046             frame.setlocal("seed", frame.getname("_inst").__getattr__("seed"));
1047             frame.setlocal("random", frame.getname("_inst").__getattr__("random"));
1048             frame.setlocal("uniform", frame.getname("_inst").__getattr__("uniform"));
1049             frame.setlocal("randint", frame.getname("_inst").__getattr__("randint"));
1050             frame.setlocal("choice", frame.getname("_inst").__getattr__("choice"));
1051             frame.setlocal("randrange", frame.getname("_inst").__getattr__("randrange"));
1052             frame.setlocal("shuffle", frame.getname("_inst").__getattr__("shuffle"));
1053             frame.setlocal("normalvariate", frame.getname("_inst").__getattr__("normalvariate"));
1054             frame.setlocal("lognormvariate", frame.getname("_inst").__getattr__("lognormvariate"));
1055             frame.setlocal("cunifvariate", frame.getname("_inst").__getattr__("cunifvariate"));
1056             frame.setlocal("expovariate", frame.getname("_inst").__getattr__("expovariate"));
1057             frame.setlocal("vonmisesvariate", frame.getname("_inst").__getattr__("vonmisesvariate"));
1058             frame.setlocal("gammavariate", frame.getname("_inst").__getattr__("gammavariate"));
1059             frame.setlocal("stdgamma", frame.getname("_inst").__getattr__("stdgamma"));
1060             frame.setlocal("gauss", frame.getname("_inst").__getattr__("gauss"));
1061             frame.setlocal("betavariate", frame.getname("_inst").__getattr__("betavariate"));
1062             frame.setlocal("paretovariate", frame.getname("_inst").__getattr__("paretovariate"));
1063             frame.setlocal("weibullvariate", frame.getname("_inst").__getattr__("weibullvariate"));
1064             frame.setlocal("getstate", frame.getname("_inst").__getattr__("getstate"));
1065             frame.setlocal("setstate", frame.getname("_inst").__getattr__("setstate"));
1066             frame.setlocal("jumpahead", frame.getname("_inst").__getattr__("jumpahead"));
1067             frame.setlocal("whseed", frame.getname("_inst").__getattr__("whseed"));
1068             if (frame.getname("__name__")._eq(s$111).__nonzero__()) {
1069                 frame.getname("_test").__call__();
1070             }
1071             return Py.None;
1072         }
1073         
1074     }
1075     public static void moduleDictInit(PyObject dict) {
1076         dict.__setitem__("__name__", new PyString("random"));
1077         Py.runCode(new _PyInner().getMain(), dict, dict);
1078     }
1079     
1080     public static void main(String[] args) throws java.lang.Exception {
1081         String[] newargs = new String[args.length+1];
1082         newargs[0] = "random";
1083         System.arraycopy(args, 0, newargs, 1, args.length);
1084         Py.runMain(random._PyInner.class, newargs, random.jpy$packages, random.jpy$mainProperties, "", new String[] {"string", "random", "util", "traceback", "sre_compile", "atexit", "sre", "sre_constants", "StringIO", "javaos", "socket", "yapm", "calendar", "repr", "copy_reg", "SocketServer", "server", "re", "linecache", "javapath", "UserDict", "copy", "threading", "stat", "PathVFS", "sre_parse"});
1085     }
1086     
1087 }