(self, function, sz)
| 2525 | seeds = range(4) |
| 2526 | |
| 2527 | def check_function(self, function, sz): |
| 2528 | from threading import Thread |
| 2529 | |
| 2530 | out1 = np.empty((len(self.seeds),) + sz) |
| 2531 | out2 = np.empty((len(self.seeds),) + sz) |
| 2532 | |
| 2533 | # threaded generation |
| 2534 | t = [Thread(target=function, args=(Generator(MT19937(s)), o)) |
| 2535 | for s, o in zip(self.seeds, out1)] |
| 2536 | [x.start() for x in t] |
| 2537 | [x.join() for x in t] |
| 2538 | |
| 2539 | # the same serial |
| 2540 | for s, o in zip(self.seeds, out2): |
| 2541 | function(Generator(MT19937(s)), o) |
| 2542 | |
| 2543 | # these platforms change x87 fpu precision mode in threads |
| 2544 | if np.intp().dtype.itemsize == 4 and sys.platform == "win32": |
| 2545 | assert_array_almost_equal(out1, out2) |
| 2546 | else: |
| 2547 | assert_array_equal(out1, out2) |
| 2548 | |
| 2549 | def test_normal(self): |
| 2550 | def gen_random(state, out): |
no test coverage detected