Skip to content

Commit 8552387

Browse files
committed
feat(lint): corrected linting for markdown and javascript files for the new package tinymt32
1 parent 39f34c9 commit 8552387

File tree

9 files changed

+67
-62
lines changed

9 files changed

+67
-62
lines changed

lib/node_modules/@stdlib/random/base/tinymt32/README.md

Lines changed: 17 additions & 26 deletions
Original file line numberDiff line numberDiff line change
@@ -223,7 +223,8 @@ Serializes the pseudorandom number generator as a JSON object.
223223

224224
```javascript
225225
var o = tinymt32.toJSON();
226-
// returns { 'type': 'PRNG', 'name': '...', 'state': {...}, 'params': [] }```
226+
// returns { 'type': 'PRNG', 'name': '...', 'state': {...}, 'params': [] }
227+
```
227228

228229
</section>
229230

@@ -247,49 +248,38 @@ var o = tinymt32.toJSON();
247248

248249
## Examples
249250

250-
<!-- eslint no-undef: "error" -->
251+
<!-- eslint-disable no-undef -->
251252

252253
```javascript
253254
var tinymt32 = require( '@stdlib/random/base/tinymt32' );
254255

255-
var seed;
256-
var rand;
256+
// Generate pseudorandom numbers:
257+
var r;
257258
var i;
258-
259-
// Generate pseudorandom numbers...
260259
for ( i = 0; i < 100; i++ ) {
261-
console.log( tinymt32() );
260+
r = tinymt32();
261+
console.log( r );
262262
}
263263

264-
// Create a new pseudorandom number generator...
265-
seed = 1234;
266-
rand = tinymt32.factory({
267-
'seed': seed
264+
// Create a new TinyMT32 PRNG initialized to the current state of `tinymt32`:
265+
var rand = tinymt32.factory({
266+
'state': tinymt32.state
268267
});
269-
for ( i = 0; i < 100; i++ ) {
270-
console.log( rand() );
271-
}
272268

273-
// Create another pseudorandom number generator using a previous seed...
274-
rand = tinymt32.factory({
275-
'seed': tinymt32.seed
276-
});
277-
for ( i = 0; i < 100; i++ ) {
278-
console.log( rand() );
279-
}
269+
// Test that the generated pseudorandom numbers are the same:
270+
var bool = ( rand() === tinymt32() );
271+
console.log( bool );
280272
```
281273

282274
</section>
283275

284276
<!-- /.examples -->
285277

286-
* * *
287-
288278
<section class="references">
289279

290280
## References
291281

292-
- Saito, Mutsuo, and Makoto Matsumoto. 2011. "Tiny Mersenne Twister (TinyMT): A small-sized variant of Mersenne Twister." <http://www.math.sci.hiroshima-u.ac.jp/~m-mat/MT/TINYMT/index.html>.
282+
- Saito, Makoto, and Mutsuo Saito. 2008. "SIMD-Oriented Fast Mersenne Twister: A 128-bit Pseudorandom Number Generator." In *Monte Carlo and Quasi-Monte Carlo Methods 2006*, edited by Alexander Keller, Stefan Heinrich, and Harald Niederreiter, 607–22. Berlin, Heidelberg: Springer Berlin Heidelberg. doi:[10.1007/978-3-540-74496-2_36][saito-2008].
293283

294284
</section>
295285

@@ -315,10 +305,11 @@ for ( i = 0; i < 100; i++ ) {
315305

316306
<section class="links">
317307

318-
[tiny-mersenne-twister]: https://www.math.sci.hiroshima-u.ac.jp/m-mat/MT/TINYMT
308+
[tiny-mersenne-twister]: https://github.com/MersenneTwister-Lab/TinyMT
309+
[saito-2008]: https://doi.org/10.1007/978-3-540-74496-2_36
319310

320311
[@stdlib/array/uint32]: https://github.com/stdlib-js/stdlib
321312

322313
</section>
323314

324-
<!-- /.links -->
315+
<!-- /.links -->

lib/node_modules/@stdlib/random/base/tinymt32/benchmark/benchmark.factory.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@
77
* you may not use this file except in compliance with the License.
88
* You may obtain a copy of the License at
99
*
10-
* http://www.apache.org/licenses/LICENSE-2.0
10+
* http://www.apache.org/licenses/LICENSE-2.0
1111
*
1212
* Unless required by applicable law or agreed to in writing, software
1313
* distributed under the License is distributed on an "AS IS" BASIS,

lib/node_modules/@stdlib/random/base/tinymt32/benchmark/benchmark.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@
77
* you may not use this file except in compliance with the License.
88
* You may obtain a copy of the License at
99
*
10-
* http://www.apache.org/licenses/LICENSE-2.0
10+
* http://www.apache.org/licenses/LICENSE-2.0
1111
*
1212
* Unless required by applicable law or agreed to in writing, software
1313
* distributed under the License is distributed on an "AS IS" BASIS,

lib/node_modules/@stdlib/random/base/tinymt32/docs/repl.txt

Lines changed: 22 additions & 24 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,3 @@
1-
21
{{alias}}()
32
Returns a pseudorandom integer on the interval `[0, 4294967295]`.
43

@@ -16,7 +15,7 @@
1615

1716
Examples
1817
--------
19-
> var r = {{alias}}()
18+
> var r = {{alias}}();
2019

2120

2221
{{alias}}.normalized()
@@ -29,7 +28,7 @@
2928

3029
Examples
3130
--------
32-
> var r = {{alias}}.normalized()
31+
> var r = {{alias}}.normalized();
3332

3433

3534
{{alias}}.factory( [options] )
@@ -70,16 +69,16 @@
7069

7170
// Provide a seed:
7271
> rand = {{alias}}.factory( { 'seed': 1234 } );
73-
> r = rand()
74-
<number> (to do)
72+
> r = rand();
73+
2682965004
7574

7675

7776
{{alias}}.NAME
7877
Generator name.
7978

8079
Examples
8180
--------
82-
> var str = {{alias}}.NAME
81+
> var str = {{alias}}.NAME;
8382
'tinymt32'
8483

8584

@@ -88,7 +87,7 @@
8887

8988
Examples
9089
--------
91-
> var v = {{alias}}.MIN
90+
> var v = {{alias}}.MIN;
9291
0
9392

9493

@@ -97,7 +96,7 @@
9796

9897
Examples
9998
--------
100-
> var v = {{alias}}.MAX
99+
> var v = {{alias}}.MAX;
101100
4294967295
102101

103102

@@ -106,45 +105,44 @@
106105

107106
Examples
108107
--------
109-
> var seed = {{alias}}.seed
108+
> var seed = {{alias}}.seed;
110109

111110

112111
{{alias}}.seedLength
113112
Length of generator seed.
114113

115114
Examples
116115
--------
117-
> var len = {{alias}}.seedLength
116+
> var len = {{alias}}.seedLength;
118117

119118

120119
{{alias}}.state
121120
Generator state.
122121

123122
Examples
124123
--------
125-
> var r = {{alias}}()
124+
> var r = {{alias}}();
126125
<number>
127-
> r = {{alias}}()
128-
<number>
129-
> r = {{alias}}()
126+
> r = {{alias}}();
130127
<number>
128+
> r = {{alias}}();
131129

132130
// Get a copy of the current state:
133-
> var state = {{alias}}.state
131+
> var state = {{alias}}.state;
134132
<Uint32Array>
135133

136-
> r = {{alias}}()
134+
> r = {{alias}}();
137135
<number>
138-
> r = {{alias}}()
136+
> r = {{alias}}();
139137
<number>
140138

141139
// Set the state:
142-
> {{alias}}.state = state
140+
> {{alias}}.state = state;
143141

144142
// Replay the last two pseudorandom numbers:
145-
> r = {{alias}}()
143+
> r = {{alias}}();
146144
<number>
147-
> r = {{alias}}()
145+
> r = {{alias}}();
148146
<number>
149147

150148

@@ -153,15 +151,15 @@
153151

154152
Examples
155153
--------
156-
> var len = {{alias}}.stateLength
154+
> var len = {{alias}}.stateLength;
157155

158156

159157
{{alias}}.byteLength
160158
Size (in bytes) of generator state.
161159

162160
Examples
163161
--------
164-
> var sz = {{alias}}.byteLength
162+
> var sz = {{alias}}.byteLength;
165163

166164

167165
{{alias}}.toJSON()
@@ -174,8 +172,8 @@
174172

175173
Examples
176174
--------
177-
> var o = {{alias}}.toJSON()
175+
> var o = {{alias}}.toJSON();
178176
{ 'type': 'PRNG', 'name': '...', 'state': {...}, 'params': [] }
179-
177+
180178
See Also
181179
--------

lib/node_modules/@stdlib/random/base/tinymt32/lib/factory.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
/* eslint-disable max-lines, max-len */
1+
/* eslint-disable max-len */
22

33
/**
44
* @license Apache-2.0

lib/node_modules/@stdlib/random/base/tinymt32/lib/index.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@
77
* you may not use this file except in compliance with the License.
88
* You may obtain a copy of the License at
99
*
10-
* http://www.apache.org/licenses/LICENSE-2.0
10+
* http://www.apache.org/licenses/LICENSE-2.0
1111
*
1212
* Unless required by applicable law or agreed to in writing, software
1313
* distributed under the License is distributed on an "AS IS" BASIS,

lib/node_modules/@stdlib/random/base/tinymt32/lib/rand_uint32.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@
77
* you may not use this file except in compliance with the License.
88
* You may obtain a copy of the License at
99
*
10-
* http://www.apache.org/licenses/LICENSE-2.0
10+
* http://www.apache.org/licenses/LICENSE-2.0
1111
*
1212
* Unless required by applicable law or agreed to in writing, software
1313
* distributed under the License is distributed on an "AS IS" BASIS,

lib/node_modules/@stdlib/random/base/tinymt32/src/main.c

Lines changed: 5 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
/**
22
* @license Apache-2.0
33
*
4-
* Copyright (c) 2018 The Stdlib Authors.
4+
* Copyright (c) 2025 The Stdlib Authors.
55
*
66
* Licensed under the Apache License, Version 2.0 (the "License");
77
* you may not use this file except in compliance with the License.
@@ -69,7 +69,7 @@ static inline void tinymt32_free( struct BasePRNGObject *obj );
6969

7070
static inline void create_state( uint32_t *state, uint32_t s );
7171
static inline void next_state( uint32_t *state, uint32_t mat1, uint32_t mat2, uint32_t tmat );
72-
static inline uint32_t temper( uint32_t *state, uint32_t mat1, uint32_t mat2, uint32_t tmat );
72+
static inline uint32_t temper( const uint32_t *state, uint32_t mat1, uint32_t mat2, uint32_t tmat );
7373

7474
// Define constants used by the algorithm:
7575
static const int32_t MIN_LOOP = 8;
@@ -189,7 +189,7 @@ static inline void next_state( uint32_t *state, uint32_t mat1, uint32_t mat2, ui
189189
* @param tmat parameter tmat
190190
* @return tempered output
191191
*/
192-
static inline uint32_t temper( uint32_t *state, uint32_t mat1, uint32_t mat2, uint32_t tmat ) {
192+
static inline uint32_t temper( const uint32_t *state, uint32_t mat1, uint32_t mat2, uint32_t tmat ) {
193193
uint32_t t0, t1;
194194

195195
// Tempering
@@ -234,9 +234,7 @@ static inline int8_t normalized( struct BasePRNGObject *obj, double *out ) {
234234
int8_t status;
235235

236236
status = next( obj, &u );
237-
if ( status != 0 ) {
238-
return status;
239-
}
237+
u = temper( obj->state, obj->mat1, obj->mat2, obj->tmat );
240238
*out = (double)u * FLOAT64_NORMALIZATION_CONSTANT;
241239
return 0;
242240
}
@@ -316,4 +314,4 @@ struct BasePRNGObject *stdlib_base_random_tinymt32_allocate( const uint32_t seed
316314
create_state( state->state, seed );
317315

318316
return obj;
319-
}
317+
}

tools/docs/jsdoc/typedefs/random.js

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,21 @@
1+
/**
2+
* @license Apache-2.0
3+
*
4+
* Copyright (c) 2025 The Stdlib Authors.
5+
*
6+
* Licensed under the Apache License, Version 2.0 (the "License");
7+
* you may not use this file except in compliance with the License.
8+
* You may obtain a copy of the License at
9+
*
10+
* http://www.apache.org/licenses/LICENSE-2.0
11+
*
12+
* Unless required by applicable law or agreed to in writing, software
13+
* distributed under the License is distributed on an "AS IS" BASIS,
14+
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
15+
* See the License for the specific language governing permissions and
16+
* limitations under the License.
17+
*/
18+
119
/**
220
* A pseudorandom number generator (PRNG).
321
*

0 commit comments

Comments
 (0)