Skip to content

Commit 37d73ba

Browse files
committed
Add separate state length property
1 parent 7c8a587 commit 37d73ba

File tree

5 files changed

+31
-2
lines changed

5 files changed

+31
-2
lines changed

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

+10-1
Original file line numberDiff line numberDiff line change
@@ -193,9 +193,18 @@ r = bernoulli( 0.3 );
193193
// ...
194194
```
195195

196+
#### bernoulli.STATE_LENGTH
197+
198+
Length of generator state.
199+
200+
```javascript
201+
var len = bernoulli.STATE_LENGTH;
202+
// returns <number>
203+
```
204+
196205
#### bernoulli.STATE_SIZE
197206

198-
Size of generator state.
207+
Size (in bytes) of generator state.
199208

200209
```javascript
201210
var sz = bernoulli.STATE_SIZE;

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

+9-1
Original file line numberDiff line numberDiff line change
@@ -114,8 +114,16 @@
114114
<number>
115115

116116

117+
{{alias}}.STATE_LENGTH
118+
Length of generator state.
119+
120+
Examples
121+
--------
122+
> var len = {{alias}}.STATE_LENGTH;
123+
124+
117125
{{alias}}.STATE_SIZE
118-
Size of generator state.
126+
Size (in bytes) of generator state.
119127

120128
Examples
121129
--------

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

+1
Original file line numberDiff line numberDiff line change
@@ -100,6 +100,7 @@ function factory() {
100100
'get': getState,
101101
'set': setState
102102
});
103+
setReadOnly( prng, 'STATE_LENGTH', rand.STATE_LENGTH );
103104
setReadOnly( prng, 'STATE_SIZE', rand.STATE_SIZE );
104105
setReadOnly( prng, 'PRNG', rand );
105106

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

+6
Original file line numberDiff line numberDiff line change
@@ -120,6 +120,12 @@ tape( 'attached to the returned function is the generator state', function test(
120120
t.end();
121121
});
122122

123+
tape( 'attached to the returned function is the generator state length', function test( t ) {
124+
var bernoulli = factory();
125+
t.equal( typeof bernoulli.STATE_LENGTH, 'number', 'has `STATE_LENGTH` property' );
126+
t.end();
127+
});
128+
123129
tape( 'attached to the returned function is the generator state size', function test( t ) {
124130
var bernoulli = factory();
125131
t.equal( typeof bernoulli.STATE_SIZE, 'number', 'has `STATE_SIZE` property' );

lib/node_modules/@stdlib/random/base/bernoulli/test/test.js

+5
Original file line numberDiff line numberDiff line change
@@ -59,6 +59,11 @@ tape( 'attached to the main export is the generator state', function test( t ) {
5959
t.end();
6060
});
6161

62+
tape( 'attached to the main export is the generator state length', function test( t ) {
63+
t.equal( typeof bernoulli.STATE_LENGTH, 'number', 'has `STATE_LENGTH` property' );
64+
t.end();
65+
});
66+
6267
tape( 'attached to the main export is the generator state size', function test( t ) {
6368
t.equal( typeof bernoulli.STATE_SIZE, 'number', 'has `STATE_SIZE` property' );
6469
t.end();

0 commit comments

Comments
 (0)