Skip to content

Commit b0cf7a1

Browse files
committed
Serialize distribution parameters
1 parent 2132e16 commit b0cf7a1

File tree

4 files changed

+13
-2
lines changed

4 files changed

+13
-2
lines changed

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

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -244,7 +244,7 @@ Serializes the pseudorandom number generator as a JSON object.
244244

245245
```javascript
246246
var o = rayleigh.toJSON();
247-
// returns { 'type': 'PRNG', 'name': '...', 'state': {...} }
247+
// returns { 'type': 'PRNG', 'name': '...', 'state': {...}, 'params': [] }
248248
```
249249

250250
</section>

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

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -162,7 +162,7 @@
162162
Examples
163163
--------
164164
> var o = {{alias}}.toJSON()
165-
{ 'type': 'PRNG', 'name': '...', 'state': {...} }
165+
{ 'type': 'PRNG', 'name': '...', 'state': {...}, 'params': [] }
166166

167167
See Also
168168
--------

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

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -187,6 +187,11 @@ function factory() {
187187
out.type = 'PRNG';
188188
out.name = prng.NAME;
189189
out.state = typedarray2json( rand.state );
190+
if ( sigma === void 0 ) {
191+
out.params = [];
192+
} else {
193+
out.params = [ sigma ];
194+
}
190195
return out;
191196
}
192197

lib/node_modules/@stdlib/random/base/rayleigh/test/test.factory.js

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -453,6 +453,12 @@ tape( 'attached to the returned function is a method to serialize the generator
453453
t.equal( o.type, 'PRNG', 'has property' );
454454
t.equal( o.name, rayleigh.NAME, 'has property' );
455455
t.deepEqual( o.state, typedarray2json( rayleigh.state ), 'has property' );
456+
t.deepEqual( o.params, [], 'has property' );
457+
458+
rayleigh = factory( 2.0 );
459+
o = rayleigh.toJSON();
460+
461+
t.deepEqual( o.params, [ 2.0 ], 'has property' );
456462

457463
t.end();
458464
});

0 commit comments

Comments
 (0)