source: EcnlProtoTool/trunk/mruby-1.3.0/mrbgems/mruby-random/src/mt19937ar.h@ 331

Last change on this file since 331 was 331, checked in by coas-nagasima, 6 years ago

prototoolに関連するプロジェクトをnewlibからmuslを使うよう変更・更新
ntshellをnewlibの下位の実装から、muslのsyscallの実装に変更・更新
以下のOSSをアップデート
・mruby-1.3.0
・musl-1.1.18
・onigmo-6.1.3
・tcc-0.9.27
以下のOSSを追加
・openssl-1.1.0e
・curl-7.57.0
・zlib-1.2.11
以下のmrbgemsを追加
・iij/mruby-digest
・iij/mruby-env
・iij/mruby-errno
・iij/mruby-iijson
・iij/mruby-ipaddr
・iij/mruby-mock
・iij/mruby-require
・iij/mruby-tls-openssl

  • Property svn:eol-style set to native
  • Property svn:mime-type set to text/x-chdr;charset=UTF-8
File size: 2.8 KB
Line 
1/*
2** mt19937ar.h - MT Random functions
3**
4** Copyright (C) 1997 - 2016, Makoto Matsumoto and Takuji Nishimura,
5** All rights reserved.
6**
7** Permission is hereby granted, free of charge, to any person obtaining
8** a copy of this software and associated documentation files (the
9** "Software"), to deal in the Software without restriction, including
10** without limitation the rights to use, copy, modify, merge, publish,
11** distribute, sublicense, and/or sell copies of the Software, and to
12** permit persons to whom the Software is furnished to do so, subject to
13** the following conditions:
14**
15** The above copyright notice and this permission notice shall be
16** included in all copies or substantial portions of the Software.
17**
18** THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
19** EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
20** MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
21** IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY
22** CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT,
23** TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE
24** SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
25**
26** [ MIT license: http://www.opensource.org/licenses/mit-license.php ]
27**
28** Any feedback is very welcome.
29** http://www.math.sci.hiroshima-u.ac.jp/~m-mat/MT/emt.html
30** email: m-mat @ math.sci.hiroshima-u.ac.jp (remove space)
31**
32** This version is modified by mruby developers. If you see any problem,
33** contact us first at https://github.com/mruby/mruby/issues
34*/
35
36#define N 624
37
38typedef struct {
39 unsigned long mt[N];
40 int mti;
41 union {
42 unsigned long int_;
43 double double_;
44 } gen;
45
46 mrb_int seed;
47 mrb_bool has_seed : 1;
48} mt_state;
49
50void mrb_random_init_genrand(mt_state *, unsigned long);
51unsigned long mrb_random_genrand_int32(mt_state *);
52double mrb_random_genrand_real1(mt_state *t);
53
54/* initializes mt[N] with a seed */
55void init_genrand(unsigned long s);
56
57/* initialize by an array with array-length */
58/* init_key is the array for initializing keys */
59/* key_length is its length */
60/* slight change for C++, 2004/2/26 */
61void init_by_array(unsigned long init_key[], int key_length);
62
63/* generates a random number on [0,0xffffffff]-interval */
64unsigned long genrand_int32(void);
65
66/* generates a random number on [0,0x7fffffff]-interval */
67long genrand_int31(void);
68
69/* These real versions are due to Isaku Wada, 2002/01/09 added */
70/* generates a random number on [0,1]-real-interval */
71double genrand_real1(void);
72
73/* generates a random number on [0,1)-real-interval */
74double genrand_real2(void);
75
76/* generates a random number on (0,1)-real-interval */
77double genrand_real3(void);
78
79/* generates a random number on [0,1) with 53-bit resolution*/
80double genrand_res53(void);
Note: See TracBrowser for help on using the repository browser.