@stdlib/random-array-kumaraswamy 0.1.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/LICENSE ADDED
@@ -0,0 +1,177 @@
1
+
2
+ Apache License
3
+ Version 2.0, January 2004
4
+ http://www.apache.org/licenses/
5
+
6
+ TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION
7
+
8
+ 1. Definitions.
9
+
10
+ "License" shall mean the terms and conditions for use, reproduction,
11
+ and distribution as defined by Sections 1 through 9 of this document.
12
+
13
+ "Licensor" shall mean the copyright owner or entity authorized by
14
+ the copyright owner that is granting the License.
15
+
16
+ "Legal Entity" shall mean the union of the acting entity and all
17
+ other entities that control, are controlled by, or are under common
18
+ control with that entity. For the purposes of this definition,
19
+ "control" means (i) the power, direct or indirect, to cause the
20
+ direction or management of such entity, whether by contract or
21
+ otherwise, or (ii) ownership of fifty percent (50%) or more of the
22
+ outstanding shares, or (iii) beneficial ownership of such entity.
23
+
24
+ "You" (or "Your") shall mean an individual or Legal Entity
25
+ exercising permissions granted by this License.
26
+
27
+ "Source" form shall mean the preferred form for making modifications,
28
+ including but not limited to software source code, documentation
29
+ source, and configuration files.
30
+
31
+ "Object" form shall mean any form resulting from mechanical
32
+ transformation or translation of a Source form, including but
33
+ not limited to compiled object code, generated documentation,
34
+ and conversions to other media types.
35
+
36
+ "Work" shall mean the work of authorship, whether in Source or
37
+ Object form, made available under the License, as indicated by a
38
+ copyright notice that is included in or attached to the work
39
+ (an example is provided in the Appendix below).
40
+
41
+ "Derivative Works" shall mean any work, whether in Source or Object
42
+ form, that is based on (or derived from) the Work and for which the
43
+ editorial revisions, annotations, elaborations, or other modifications
44
+ represent, as a whole, an original work of authorship. For the purposes
45
+ of this License, Derivative Works shall not include works that remain
46
+ separable from, or merely link (or bind by name) to the interfaces of,
47
+ the Work and Derivative Works thereof.
48
+
49
+ "Contribution" shall mean any work of authorship, including
50
+ the original version of the Work and any modifications or additions
51
+ to that Work or Derivative Works thereof, that is intentionally
52
+ submitted to Licensor for inclusion in the Work by the copyright owner
53
+ or by an individual or Legal Entity authorized to submit on behalf of
54
+ the copyright owner. For the purposes of this definition, "submitted"
55
+ means any form of electronic, verbal, or written communication sent
56
+ to the Licensor or its representatives, including but not limited to
57
+ communication on electronic mailing lists, source code control systems,
58
+ and issue tracking systems that are managed by, or on behalf of, the
59
+ Licensor for the purpose of discussing and improving the Work, but
60
+ excluding communication that is conspicuously marked or otherwise
61
+ designated in writing by the copyright owner as "Not a Contribution."
62
+
63
+ "Contributor" shall mean Licensor and any individual or Legal Entity
64
+ on behalf of whom a Contribution has been received by Licensor and
65
+ subsequently incorporated within the Work.
66
+
67
+ 2. Grant of Copyright License. Subject to the terms and conditions of
68
+ this License, each Contributor hereby grants to You a perpetual,
69
+ worldwide, non-exclusive, no-charge, royalty-free, irrevocable
70
+ copyright license to reproduce, prepare Derivative Works of,
71
+ publicly display, publicly perform, sublicense, and distribute the
72
+ Work and such Derivative Works in Source or Object form.
73
+
74
+ 3. Grant of Patent License. Subject to the terms and conditions of
75
+ this License, each Contributor hereby grants to You a perpetual,
76
+ worldwide, non-exclusive, no-charge, royalty-free, irrevocable
77
+ (except as stated in this section) patent license to make, have made,
78
+ use, offer to sell, sell, import, and otherwise transfer the Work,
79
+ where such license applies only to those patent claims licensable
80
+ by such Contributor that are necessarily infringed by their
81
+ Contribution(s) alone or by combination of their Contribution(s)
82
+ with the Work to which such Contribution(s) was submitted. If You
83
+ institute patent litigation against any entity (including a
84
+ cross-claim or counterclaim in a lawsuit) alleging that the Work
85
+ or a Contribution incorporated within the Work constitutes direct
86
+ or contributory patent infringement, then any patent licenses
87
+ granted to You under this License for that Work shall terminate
88
+ as of the date such litigation is filed.
89
+
90
+ 4. Redistribution. You may reproduce and distribute copies of the
91
+ Work or Derivative Works thereof in any medium, with or without
92
+ modifications, and in Source or Object form, provided that You
93
+ meet the following conditions:
94
+
95
+ (a) You must give any other recipients of the Work or
96
+ Derivative Works a copy of this License; and
97
+
98
+ (b) You must cause any modified files to carry prominent notices
99
+ stating that You changed the files; and
100
+
101
+ (c) You must retain, in the Source form of any Derivative Works
102
+ that You distribute, all copyright, patent, trademark, and
103
+ attribution notices from the Source form of the Work,
104
+ excluding those notices that do not pertain to any part of
105
+ the Derivative Works; and
106
+
107
+ (d) If the Work includes a "NOTICE" text file as part of its
108
+ distribution, then any Derivative Works that You distribute must
109
+ include a readable copy of the attribution notices contained
110
+ within such NOTICE file, excluding those notices that do not
111
+ pertain to any part of the Derivative Works, in at least one
112
+ of the following places: within a NOTICE text file distributed
113
+ as part of the Derivative Works; within the Source form or
114
+ documentation, if provided along with the Derivative Works; or,
115
+ within a display generated by the Derivative Works, if and
116
+ wherever such third-party notices normally appear. The contents
117
+ of the NOTICE file are for informational purposes only and
118
+ do not modify the License. You may add Your own attribution
119
+ notices within Derivative Works that You distribute, alongside
120
+ or as an addendum to the NOTICE text from the Work, provided
121
+ that such additional attribution notices cannot be construed
122
+ as modifying the License.
123
+
124
+ You may add Your own copyright statement to Your modifications and
125
+ may provide additional or different license terms and conditions
126
+ for use, reproduction, or distribution of Your modifications, or
127
+ for any such Derivative Works as a whole, provided Your use,
128
+ reproduction, and distribution of the Work otherwise complies with
129
+ the conditions stated in this License.
130
+
131
+ 5. Submission of Contributions. Unless You explicitly state otherwise,
132
+ any Contribution intentionally submitted for inclusion in the Work
133
+ by You to the Licensor shall be under the terms and conditions of
134
+ this License, without any additional terms or conditions.
135
+ Notwithstanding the above, nothing herein shall supersede or modify
136
+ the terms of any separate license agreement you may have executed
137
+ with Licensor regarding such Contributions.
138
+
139
+ 6. Trademarks. This License does not grant permission to use the trade
140
+ names, trademarks, service marks, or product names of the Licensor,
141
+ except as required for reasonable and customary use in describing the
142
+ origin of the Work and reproducing the content of the NOTICE file.
143
+
144
+ 7. Disclaimer of Warranty. Unless required by applicable law or
145
+ agreed to in writing, Licensor provides the Work (and each
146
+ Contributor provides its Contributions) on an "AS IS" BASIS,
147
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
148
+ implied, including, without limitation, any warranties or conditions
149
+ of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A
150
+ PARTICULAR PURPOSE. You are solely responsible for determining the
151
+ appropriateness of using or redistributing the Work and assume any
152
+ risks associated with Your exercise of permissions under this License.
153
+
154
+ 8. Limitation of Liability. In no event and under no legal theory,
155
+ whether in tort (including negligence), contract, or otherwise,
156
+ unless required by applicable law (such as deliberate and grossly
157
+ negligent acts) or agreed to in writing, shall any Contributor be
158
+ liable to You for damages, including any direct, indirect, special,
159
+ incidental, or consequential damages of any character arising as a
160
+ result of this License or out of the use or inability to use the
161
+ Work (including but not limited to damages for loss of goodwill,
162
+ work stoppage, computer failure or malfunction, or any and all
163
+ other commercial damages or losses), even if such Contributor
164
+ has been advised of the possibility of such damages.
165
+
166
+ 9. Accepting Warranty or Additional Liability. While redistributing
167
+ the Work or Derivative Works thereof, You may choose to offer,
168
+ and charge a fee for, acceptance of support, warranty, indemnity,
169
+ or other liability obligations and/or rights consistent with this
170
+ License. However, in accepting such obligations, You may act only
171
+ on Your own behalf and on Your sole responsibility, not on behalf
172
+ of any other Contributor, and only if You agree to indemnify,
173
+ defend, and hold each Contributor harmless for any liability
174
+ incurred by, or claims asserted against, such Contributor by reason
175
+ of your accepting any such warranty or additional liability.
176
+
177
+ END OF TERMS AND CONDITIONS
package/NOTICE ADDED
@@ -0,0 +1 @@
1
+ Copyright (c) 2016-2024 The Stdlib Authors.
package/README.md ADDED
@@ -0,0 +1,469 @@
1
+ <!--
2
+
3
+ @license Apache-2.0
4
+
5
+ Copyright (c) 2024 The Stdlib Authors.
6
+
7
+ Licensed under the Apache License, Version 2.0 (the "License");
8
+ you may not use this file except in compliance with the License.
9
+ You may obtain a copy of the License at
10
+
11
+ http://www.apache.org/licenses/LICENSE-2.0
12
+
13
+ Unless required by applicable law or agreed to in writing, software
14
+ distributed under the License is distributed on an "AS IS" BASIS,
15
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
16
+ See the License for the specific language governing permissions and
17
+ limitations under the License.
18
+
19
+ -->
20
+
21
+
22
+ <details>
23
+ <summary>
24
+ About stdlib...
25
+ </summary>
26
+ <p>We believe in a future in which the web is a preferred environment for numerical computation. To help realize this future, we've built stdlib. stdlib is a standard library, with an emphasis on numerical and scientific computation, written in JavaScript (and C) for execution in browsers and in Node.js.</p>
27
+ <p>The library is fully decomposable, being architected in such a way that you can swap out and mix and match APIs and functionality to cater to your exact preferences and use cases.</p>
28
+ <p>When you use stdlib, you can be absolutely certain that you are using the most thorough, rigorous, well-written, studied, documented, tested, measured, and high-quality code out there.</p>
29
+ <p>To join us in bringing numerical computing to the web, get started by checking us out on <a href="https://github.com/stdlib-js/stdlib">GitHub</a>, and please consider <a href="https://opencollective.com/stdlib">financially supporting stdlib</a>. We greatly appreciate your continued support!</p>
30
+ </details>
31
+
32
+ # Kumaraswamy's Double Bounded Random Numbers
33
+
34
+ [![NPM version][npm-image]][npm-url] [![Build Status][test-image]][test-url] [![Coverage Status][coverage-image]][coverage-url] <!-- [![dependencies][dependencies-image]][dependencies-url] -->
35
+
36
+ > Create an array containing pseudorandom numbers drawn from [Kumaraswamy's double bounded][@stdlib/random/base/kumaraswamy] distribution.
37
+
38
+ <section class="installation">
39
+
40
+ ## Installation
41
+
42
+ ```bash
43
+ npm install @stdlib/random-array-kumaraswamy
44
+ ```
45
+
46
+ </section>
47
+
48
+ <section class="usage">
49
+
50
+ ## Usage
51
+
52
+ ```javascript
53
+ var kumaraswamy = require( '@stdlib/random-array-kumaraswamy' );
54
+ ```
55
+
56
+ #### kumaraswamy( len, a, b\[, options] )
57
+
58
+ Returns an array containing pseudorandom numbers drawn from [Kumaraswamy's double bounded][@stdlib/random/base/kumaraswamy] distribution.
59
+
60
+ ```javascript
61
+ var out = kumaraswamy( 10, 2.0, 5.0 );
62
+ // returns <Float64Array>
63
+ ```
64
+
65
+ The function has the following parameters:
66
+
67
+ - **len**: output array length.
68
+ - **a**: first shape parameter.
69
+ - **b**: second shape parameter.
70
+ - **options**: function options.
71
+
72
+ The function accepts the following `options`:
73
+
74
+ - **dtype**: output array data type. Must be a [real-valued floating-point data type][@stdlib/array/typed-real-float-dtypes] or "generic". Default: `'float64'`.
75
+
76
+ By default, the function returns a [`Float64Array`][@stdlib/array/float64]. To return an array having a different data type, set the `dtype` option.
77
+
78
+ ```javascript
79
+ var opts = {
80
+ 'dtype': 'generic'
81
+ };
82
+
83
+ var out = kumaraswamy( 10, 2.0, 5.0, opts );
84
+ // returns [...]
85
+ ```
86
+
87
+ #### kumaraswamy.assign( a, b, out )
88
+
89
+ Fills an array with pseudorandom numbers drawn from [Kumaraswamy's double bounded][@stdlib/random/base/kumaraswamy] distribution.
90
+
91
+ ```javascript
92
+ var zeros = require( '@stdlib/array-zeros' );
93
+
94
+ var x = zeros( 10, 'float64' );
95
+ // returns <Float64Array>
96
+
97
+ var out = kumaraswamy.assign( 2.0, 5.0, x );
98
+ // returns <Float64Array>
99
+
100
+ var bool = ( out === x );
101
+ // returns true
102
+ ```
103
+
104
+ The function has the following parameters:
105
+
106
+ - **a**: first shape parameter.
107
+ - **b**: second shape parameter.
108
+ - **out**: output array.
109
+
110
+ #### kumaraswamy.factory( \[a, b, ]\[options] )
111
+
112
+ Returns a function for creating arrays containing pseudorandom numbers drawn from [Kumaraswamy's double bounded][@stdlib/random/base/kumaraswamy] distribution.
113
+
114
+ ```javascript
115
+ var random = kumaraswamy.factory();
116
+
117
+ var out = random( 10, 2.0, 5.0 );
118
+ // returns <Float64Array>
119
+
120
+ var len = out.length;
121
+ // returns 10
122
+ ```
123
+
124
+ If provided distribution parameters, the returned generator returns random variates from the specified distribution.
125
+
126
+ ```javascript
127
+ var random = kumaraswamy.factory( 2.0, 5.0 );
128
+
129
+ var out = random( 10 );
130
+ // returns <Float64Array>
131
+
132
+ out = random( 10 );
133
+ // returns <Float64Array>
134
+ ```
135
+
136
+ If not provided distribution parameters, the returned generator requires that distribution parameters be provided at each invocation.
137
+
138
+ ```javascript
139
+ var random = kumaraswamy.factory();
140
+
141
+ var out = random( 10, 2.0, 5.0 );
142
+ // returns <Float64Array>
143
+
144
+ out = random( 10, 2.0, 5.0 );
145
+ // returns <Float64Array>
146
+ ```
147
+
148
+ The function accepts the following `options`:
149
+
150
+ - **prng**: pseudorandom number generator for generating uniformly distributed pseudorandom numbers on the interval `[0,1)`. If provided, the function **ignores** both the `state` and `seed` options. In order to seed the underlying pseudorandom number generator, one must seed the provided `prng` (assuming the provided `prng` is seedable).
151
+ - **seed**: pseudorandom number generator seed.
152
+ - **state**: a [`Uint32Array`][@stdlib/array/uint32] containing pseudorandom number generator state. If provided, the function ignores the `seed` option.
153
+ - **copy**: `boolean` indicating whether to copy a provided pseudorandom number generator state. Setting this option to `false` allows sharing state between two or more pseudorandom number generators. Setting this option to `true` ensures that an underlying generator has exclusive control over its internal state. Default: `true`.
154
+ - **dtype**: default output array data type. Must be a [real-valued floating-point data type][@stdlib/array/typed-real-float-dtypes] or "generic". Default: `'float64'`.
155
+
156
+ To use a custom PRNG as the underlying source of uniformly distributed pseudorandom numbers, set the `prng` option.
157
+
158
+ ```javascript
159
+ var minstd = require( '@stdlib/random-base-minstd' );
160
+
161
+ var opts = {
162
+ 'prng': minstd.normalized
163
+ };
164
+ var random = kumaraswamy.factory( 2.0, 5.0, opts );
165
+
166
+ var out = random( 10 );
167
+ // returns <Float64Array>
168
+ ```
169
+
170
+ To seed the underlying pseudorandom number generator, set the `seed` option.
171
+
172
+ ```javascript
173
+ var opts = {
174
+ 'seed': 12345
175
+ };
176
+ var random = kumaraswamy.factory( 2.0, 5.0, opts );
177
+
178
+ var out = random( 10, opts );
179
+ // returns <Float64Array>
180
+ ```
181
+
182
+ The returned function accepts the following `options`:
183
+
184
+ - **dtype**: output array data type. Must be a [real-valued floating-point data type][@stdlib/array/typed-real-float-dtypes] or "generic". This overrides the default output array data type.
185
+
186
+ To override the default output array data type, set the `dtype` option.
187
+
188
+ ```javascript
189
+ var random = kumaraswamy.factory( 2.0, 5.0 );
190
+
191
+ var out = random( 10 );
192
+ // returns <Float64Array>
193
+
194
+ var opts = {
195
+ 'dtype': 'generic'
196
+ };
197
+ out = random( 10, opts );
198
+ // returns [...]
199
+ ```
200
+
201
+ #### kumaraswamy.PRNG
202
+
203
+ The underlying pseudorandom number generator.
204
+
205
+ ```javascript
206
+ var prng = kumaraswamy.PRNG;
207
+ // returns <Function>
208
+ ```
209
+
210
+ #### kumaraswamy.seed
211
+
212
+ The value used to seed the underlying pseudorandom number generator.
213
+
214
+ ```javascript
215
+ var seed = kumaraswamy.seed;
216
+ // returns <Uint32Array>
217
+ ```
218
+
219
+ If the `factory` method is provided a PRNG for uniformly distributed numbers, the associated property value on the returned function is `null`.
220
+
221
+ ```javascript
222
+ var minstd = require( '@stdlib/random-base-minstd-shuffle' ).normalized;
223
+
224
+ var random = kumaraswamy.factory( 2.0, 5.0, {
225
+ 'prng': minstd
226
+ });
227
+
228
+ var seed = random.seed;
229
+ // returns null
230
+ ```
231
+
232
+ #### kumaraswamy.seedLength
233
+
234
+ Length of underlying pseudorandom number generator seed.
235
+
236
+ ```javascript
237
+ var len = kumaraswamy.seedLength;
238
+ // returns <number>
239
+ ```
240
+
241
+ If the `factory` method is provided a PRNG for uniformly distributed numbers, the associated property value on the returned function is `null`.
242
+
243
+ ```javascript
244
+ var minstd = require( '@stdlib/random-base-minstd-shuffle' ).normalized;
245
+
246
+ var random = kumaraswamy.factory( 2.0, 5.0, {
247
+ 'prng': minstd
248
+ });
249
+
250
+ var len = random.seedLength;
251
+ // returns null
252
+ ```
253
+
254
+ #### kumaraswamy.state
255
+
256
+ Writable property for getting and setting the underlying pseudorandom number generator state.
257
+
258
+ ```javascript
259
+ var state = kumaraswamy.state;
260
+ // returns <Uint32Array>
261
+ ```
262
+
263
+ If the `factory` method is provided a PRNG for uniformly distributed numbers, the associated property value on the returned function is `null`.
264
+
265
+ ```javascript
266
+ var minstd = require( '@stdlib/random-base-minstd-shuffle' ).normalized;
267
+
268
+ var random = kumaraswamy.factory( 2.0, 5.0, {
269
+ 'prng': minstd
270
+ });
271
+
272
+ var state = random.state;
273
+ // returns null
274
+ ```
275
+
276
+ #### kumaraswamy.stateLength
277
+
278
+ Length of underlying pseudorandom number generator state.
279
+
280
+ ```javascript
281
+ var len = kumaraswamy.stateLength;
282
+ // returns <number>
283
+ ```
284
+
285
+ If the `factory` method is provided a PRNG for uniformly distributed numbers, the associated property value on the returned function is `null`.
286
+
287
+ ```javascript
288
+ var minstd = require( '@stdlib/random-base-minstd-shuffle' ).normalized;
289
+
290
+ var random = kumaraswamy.factory( 2.0, 5.0, {
291
+ 'prng': minstd
292
+ });
293
+
294
+ var len = random.stateLength;
295
+ // returns null
296
+ ```
297
+
298
+ #### kumaraswamy.byteLength
299
+
300
+ Size (in bytes) of underlying pseudorandom number generator state.
301
+
302
+ ```javascript
303
+ var sz = kumaraswamy.byteLength;
304
+ // returns <number>
305
+ ```
306
+
307
+ If the `factory` method is provided a PRNG for uniformly distributed numbers, the associated property value on the returned function is `null`.
308
+
309
+ ```javascript
310
+ var minstd = require( '@stdlib/random-base-minstd-shuffle' ).normalized;
311
+
312
+ var random = kumaraswamy.factory( 2.0, 5.0, {
313
+ 'prng': minstd
314
+ });
315
+
316
+ var sz = random.byteLength;
317
+ // returns null
318
+ ```
319
+
320
+ </section>
321
+
322
+ <!-- /.usage -->
323
+
324
+ <section class="notes">
325
+
326
+ ## Notes
327
+
328
+ - If PRNG state is "shared" (meaning a state array was provided during function creation and **not** copied) and one sets the underlying generator state to a state array having a different length, the function returned by the `factory` method does **not** update the existing shared state and, instead, points to the newly provided state array. In order to synchronize the output of the underlying generator according to the new shared state array, the state array for **each** relevant creation function and/or PRNG must be **explicitly** set.
329
+ - If PRNG state is "shared" and one sets the underlying generator state to a state array of the same length, the PRNG state is updated (along with the state of all other creation functions and/or PRNGs sharing the PRNG's state array).
330
+
331
+ </section>
332
+
333
+ <!-- /.notes -->
334
+
335
+ <section class="examples">
336
+
337
+ ## Examples
338
+
339
+ <!-- eslint no-undef: "error" -->
340
+
341
+ ```javascript
342
+ var logEach = require( '@stdlib/console-log-each' );
343
+ var kumaraswamy = require( '@stdlib/random-array-kumaraswamy' );
344
+
345
+ // Create a function for generating random arrays originating from the same state:
346
+ var random = kumaraswamy.factory( 2.0, 5.0, {
347
+ 'state': kumaraswamy.state,
348
+ 'copy': true
349
+ });
350
+
351
+ // Generate 3 arrays:
352
+ var x1 = random( 5 );
353
+ var x2 = random( 5 );
354
+ var x3 = random( 5 );
355
+
356
+ // Print the contents:
357
+ logEach( '%f, %f, %f', x1, x2, x3 );
358
+
359
+ // Create another function for generating random arrays with the original state:
360
+ random = kumaraswamy.factory( 2.0, 5.0, {
361
+ 'state': kumaraswamy.state,
362
+ 'copy': true
363
+ });
364
+
365
+ // Generate a single array which replicates the above pseudorandom number generation sequence:
366
+ var x4 = random( 15 );
367
+
368
+ // Print the contents:
369
+ logEach( '%f', x4 );
370
+ ```
371
+
372
+ </section>
373
+
374
+ <!-- /.examples -->
375
+
376
+ <!-- Section for related `stdlib` packages. Do not manually edit this section, as it is automatically populated. -->
377
+
378
+ <section class="related">
379
+
380
+ * * *
381
+
382
+ ## See Also
383
+
384
+ - <span class="package-name">[`@stdlib/random-base/kumaraswamy`][@stdlib/random/base/kumaraswamy]</span><span class="delimiter">: </span><span class="description">Kumaraswamy's double bounded distributed pseudorandom numbers.</span>
385
+
386
+ </section>
387
+
388
+ <!-- /.related -->
389
+
390
+ <!-- Section for all links. Make sure to keep an empty line after the `section` element and another before the `/section` close. -->
391
+
392
+
393
+ <section class="main-repo" >
394
+
395
+ * * *
396
+
397
+ ## Notice
398
+
399
+ This package is part of [stdlib][stdlib], a standard library for JavaScript and Node.js, with an emphasis on numerical and scientific computing. The library provides a collection of robust, high performance libraries for mathematics, statistics, streams, utilities, and more.
400
+
401
+ For more information on the project, filing bug reports and feature requests, and guidance on how to develop [stdlib][stdlib], see the main project [repository][stdlib].
402
+
403
+ #### Community
404
+
405
+ [![Chat][chat-image]][chat-url]
406
+
407
+ ---
408
+
409
+ ## License
410
+
411
+ See [LICENSE][stdlib-license].
412
+
413
+
414
+ ## Copyright
415
+
416
+ Copyright &copy; 2016-2024. The Stdlib [Authors][stdlib-authors].
417
+
418
+ </section>
419
+
420
+ <!-- /.stdlib -->
421
+
422
+ <!-- Section for all links. Make sure to keep an empty line after the `section` element and another before the `/section` close. -->
423
+
424
+ <section class="links">
425
+
426
+ [npm-image]: http://img.shields.io/npm/v/@stdlib/random-array-kumaraswamy.svg
427
+ [npm-url]: https://npmjs.org/package/@stdlib/random-array-kumaraswamy
428
+
429
+ [test-image]: https://github.com/stdlib-js/random-array-kumaraswamy/actions/workflows/test.yml/badge.svg?branch=v0.1.0
430
+ [test-url]: https://github.com/stdlib-js/random-array-kumaraswamy/actions/workflows/test.yml?query=branch:v0.1.0
431
+
432
+ [coverage-image]: https://img.shields.io/codecov/c/github/stdlib-js/random-array-kumaraswamy/main.svg
433
+ [coverage-url]: https://codecov.io/github/stdlib-js/random-array-kumaraswamy?branch=main
434
+
435
+ <!--
436
+
437
+ [dependencies-image]: https://img.shields.io/david/stdlib-js/random-array-kumaraswamy.svg
438
+ [dependencies-url]: https://david-dm.org/stdlib-js/random-array-kumaraswamy/main
439
+
440
+ -->
441
+
442
+ [chat-image]: https://img.shields.io/gitter/room/stdlib-js/stdlib.svg
443
+ [chat-url]: https://app.gitter.im/#/room/#stdlib-js_stdlib:gitter.im
444
+
445
+ [stdlib]: https://github.com/stdlib-js/stdlib
446
+
447
+ [stdlib-authors]: https://github.com/stdlib-js/stdlib/graphs/contributors
448
+
449
+ [umd]: https://github.com/umdjs/umd
450
+ [es-module]: https://developer.mozilla.org/en-US/docs/Web/JavaScript/Guide/Modules
451
+
452
+ [deno-url]: https://github.com/stdlib-js/random-array-kumaraswamy/tree/deno
453
+ [umd-url]: https://github.com/stdlib-js/random-array-kumaraswamy/tree/umd
454
+ [esm-url]: https://github.com/stdlib-js/random-array-kumaraswamy/tree/esm
455
+ [branches-url]: https://github.com/stdlib-js/random-array-kumaraswamy/blob/main/branches.md
456
+
457
+ [stdlib-license]: https://raw.githubusercontent.com/stdlib-js/random-array-kumaraswamy/main/LICENSE
458
+
459
+ [@stdlib/random/base/kumaraswamy]: https://www.npmjs.com/package/@stdlib/random-base-kumaraswamy
460
+
461
+ [@stdlib/array/typed-real-float-dtypes]: https://www.npmjs.com/package/@stdlib/array-typed-real-float-dtypes
462
+
463
+ [@stdlib/array/uint32]: https://www.npmjs.com/package/@stdlib/array-uint32
464
+
465
+ [@stdlib/array/float64]: https://www.npmjs.com/package/@stdlib/array-float64
466
+
467
+ </section>
468
+
469
+ <!-- /.links -->
package/SECURITY.md ADDED
@@ -0,0 +1,5 @@
1
+ # Security
2
+
3
+ > Policy for reporting security vulnerabilities.
4
+
5
+ See the security policy [in the main project repository](https://github.com/stdlib-js/stdlib/security).
@@ -0,0 +1,3 @@
1
+ /// <reference path="../docs/types/index.d.ts" />
2
+ import kumaraswamy from '../docs/types/index';
3
+ export = kumaraswamy;
package/dist/index.js ADDED
@@ -0,0 +1,7 @@
1
+ "use strict";var a=function(o,r){return function(){return r||o((r={exports:{}}).exports,r),r.exports}};var e=a(function(m,t){
2
+ var v=require('@stdlib/random-array-tools-binary-factory/dist'),y=require('@stdlib/array-dtypes/dist'),c=require('@stdlib/array-defaults/dist'),n=require('@stdlib/random-base-kumaraswamy/dist'),q=y("real_floating_point_and_generic"),f=v(n,q,c.get("dtypes.real_floating_point"));t.exports=f
3
+ });var s=a(function(x,i){
4
+ var p=e(),l=p();i.exports=l
5
+ });var _=require('@stdlib/utils-define-nonenumerable-read-only-property/dist'),u=s(),d=e();_(u,"factory",d);module.exports=u;
6
+ /** @license Apache-2.0 */
7
+ //# sourceMappingURL=index.js.map
@@ -0,0 +1,7 @@
1
+ {
2
+ "version": 3,
3
+ "sources": ["../lib/factory.js", "../lib/main.js", "../lib/index.js"],
4
+ "sourcesContent": ["/**\n* @license Apache-2.0\n*\n* Copyright (c) 2024 The Stdlib Authors.\n*\n* Licensed under the Apache License, Version 2.0 (the \"License\");\n* you may not use this file except in compliance with the License.\n* You may obtain a copy of the License at\n*\n* http://www.apache.org/licenses/LICENSE-2.0\n*\n* Unless required by applicable law or agreed to in writing, software\n* distributed under the License is distributed on an \"AS IS\" BASIS,\n* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n* See the License for the specific language governing permissions and\n* limitations under the License.\n*/\n\n'use strict';\n\n// MODULES //\n\nvar binaryFactory = require( '@stdlib/random-array-tools-binary-factory' );\nvar dtypes = require( '@stdlib/array-dtypes' );\nvar defaults = require( '@stdlib/array-defaults' );\nvar base = require( '@stdlib/random-base-kumaraswamy' );\n\n\n// VARIABLES //\n\nvar DTYPES = dtypes( 'real_floating_point_and_generic' );\n\n\n// MAIN //\n\n/**\n* Returns a function for creating arrays containing pseudorandom numbers drawn from Kumaraswamy's double bounded distribution.\n*\n* @name factory\n* @type {Function}\n* @param {PositiveNumber} [a] - first shape parameter\n* @param {PositiveNumber} [b] - second shape parameter\n* @param {Options} [options] - function options\n* @param {PRNG} [options.prng] - pseudorandom number generator which generates uniformly distributed pseudorandom numbers\n* @param {PRNGSeedMT19937} [options.seed] - pseudorandom number generator seed\n* @param {PRNGStateMT19937} [options.state] - pseudorandom number generator state\n* @param {boolean} [options.copy=true] - boolean indicating whether to copy a provided pseudorandom number generator state\n* @param {string} [options.dtype=\"float64\"] - default data type\n* @throws {TypeError} `a` must be a positive number\n* @throws {TypeError} `b` must be a positive number\n* @throws {TypeError} options argument must be an object\n* @throws {TypeError} must provide valid options\n* @throws {Error} must provide a valid state\n* @returns {Function} function for creating arrays\n*\n* @example\n* var kumaraswamy = factory( 2.0, 5.0 );\n* // returns <Function>\n*\n* var arr = kumaraswamy( 10 );\n* // returns <Float64Array>\n*\n* @example\n* var kumaraswamy = factory( 2.0, 5.0 );\n* // returns <Function>\n*\n* var arr = kumaraswamy( 10, {\n* 'dtype': 'generic'\n* });\n* // returns [...]\n*/\nvar factory = binaryFactory( base, DTYPES, defaults.get( 'dtypes.real_floating_point' ) );\n\n\n// EXPORTS //\n\nmodule.exports = factory;\n", "/**\n* @license Apache-2.0\n*\n* Copyright (c) 2024 The Stdlib Authors.\n*\n* Licensed under the Apache License, Version 2.0 (the \"License\");\n* you may not use this file except in compliance with the License.\n* You may obtain a copy of the License at\n*\n* http://www.apache.org/licenses/LICENSE-2.0\n*\n* Unless required by applicable law or agreed to in writing, software\n* distributed under the License is distributed on an \"AS IS\" BASIS,\n* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n* See the License for the specific language governing permissions and\n* limitations under the License.\n*/\n\n'use strict';\n\n// MODULES //\n\nvar factory = require( './factory.js' );\n\n\n// MAIN //\n\n/**\n* Returns an array containing pseudorandom numbers drawn from Kumaraswamy's double bounded distribution.\n*\n* @name kumaraswamy\n* @type {Function}\n* @param {NonNegativeInteger} len - array length\n* @param {PositiveNumber} a - first shape parameter\n* @param {PositiveNumber} b - second shape parameter\n* @param {Options} [options] - options\n* @param {string} [options.dtype=\"float64\"] - output array data type\n* @throws {TypeError} first argument must be a nonnegative integer\n* @throws {TypeError} options argument must be an object\n* @throws {TypeError} must provide valid options\n* @returns {(Array|TypedArray)} output array\n*\n* @example\n* var arr = kumaraswamy( 10, 2.0, 5.0 );\n* // returns <Float64Array>\n*\n* @example\n* var arr = kumaraswamy( 10, 2.0, 5.0, {\n* 'dtype': 'generic'\n* });\n* // returns [...]\n*/\nvar kumaraswamy = factory();\n\n\n// EXPORTS //\n\nmodule.exports = kumaraswamy;\n", "/**\n* @license Apache-2.0\n*\n* Copyright (c) 2024 The Stdlib Authors.\n*\n* Licensed under the Apache License, Version 2.0 (the \"License\");\n* you may not use this file except in compliance with the License.\n* You may obtain a copy of the License at\n*\n* http://www.apache.org/licenses/LICENSE-2.0\n*\n* Unless required by applicable law or agreed to in writing, software\n* distributed under the License is distributed on an \"AS IS\" BASIS,\n* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n* See the License for the specific language governing permissions and\n* limitations under the License.\n*/\n\n'use strict';\n\n/**\n* Create an array containing pseudorandom numbers drawn from Kumaraswamy's double bounded distribution.\n*\n* @module @stdlib/random-array-kumaraswamy\n*\n* @example\n* var kumaraswamy = require( '@stdlib/random-array-kumaraswamy' );\n*\n* var arr = kumaraswamy( 10, 2.0, 5.0 );\n* // returns <Float64Array>\n*\n* @example\n* var kumaraswamy = require( '@stdlib/random-array-kumaraswamy' );\n*\n* var arr = kumaraswamy( 10, 2.0, 5.0, {\n* 'dtype': 'generic'\n* });\n* // returns [...]\n*\n* @example\n* var kumaraswamy = require( '@stdlib/random-array-kumaraswamy' );\n*\n* var rand = kumaraswamy.factory( 2.0, 5.0 );\n* // returns <Function>\n*\n* var arr = rand( 10 );\n* // returns <Float64Array>\n*\n* @example\n* var kumaraswamy = require( '@stdlib/random-array-kumaraswamy' );\n*\n* var rand = kumaraswamy.factory( 2.0, 5.0 );\n* // returns <Function>\n*\n* var arr = rand( 10, {\n* 'dtype': 'generic'\n* });\n* // returns [...]\n*/\n\n// MODULES //\n\nvar setReadOnly = require( '@stdlib/utils-define-nonenumerable-read-only-property' );\nvar main = require( './main.js' );\nvar factory = require( './factory.js' );\n\n\n// MAIN //\n\nsetReadOnly( main, 'factory', factory );\n\n\n// EXPORTS //\n\nmodule.exports = main;\n\n// exports: { \"factory\": \"main.factory\", \"assign\": \"main.assign\" }\n"],
5
+ "mappings": "uGAAA,IAAAA,EAAAC,EAAA,SAAAC,EAAAC,EAAA,cAsBA,IAAIC,EAAgB,QAAS,2CAA4C,EACrEC,EAAS,QAAS,sBAAuB,EACzCC,EAAW,QAAS,wBAAyB,EAC7CC,EAAO,QAAS,iCAAkC,EAKlDC,EAASH,EAAQ,iCAAkC,EAyCnDI,EAAUL,EAAeG,EAAMC,EAAQF,EAAS,IAAK,4BAA6B,CAAE,EAKxFH,EAAO,QAAUM,IC5EjB,IAAAC,EAAAC,EAAA,SAAAC,EAAAC,EAAA,cAsBA,IAAIC,EAAU,IA8BVC,EAAcD,EAAQ,EAK1BD,EAAO,QAAUE,ICKjB,IAAIC,EAAc,QAAS,uDAAwD,EAC/EC,EAAO,IACPC,EAAU,IAKdF,EAAaC,EAAM,UAAWC,CAAQ,EAKtC,OAAO,QAAUD",
6
+ "names": ["require_factory", "__commonJSMin", "exports", "module", "binaryFactory", "dtypes", "defaults", "base", "DTYPES", "factory", "require_main", "__commonJSMin", "exports", "module", "factory", "kumaraswamy", "setReadOnly", "main", "factory"]
7
+ }
@@ -0,0 +1,279 @@
1
+ /*
2
+ * @license Apache-2.0
3
+ *
4
+ * Copyright (c) 2024 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
+
19
+ // TypeScript Version: 4.1
20
+
21
+ /// <reference types="@stdlib/types"/>
22
+
23
+ import { RealFloatingPointAndGenericDataType as DataType, FloatTypedArray } from '@stdlib/types/array';
24
+ import * as random from '@stdlib/types/random';
25
+
26
+ /**
27
+ * Output array.
28
+ */
29
+ type RandomArray = FloatTypedArray | Array<number>;
30
+
31
+ /**
32
+ * Interface defining PRNG options.
33
+ */
34
+ interface PRNGOptions {
35
+ /**
36
+ * Pseudorandom number generator which generates uniformly distributed pseudorandom numbers.
37
+ */
38
+ prng?: random.PRNG;
39
+
40
+ /**
41
+ * Pseudorandom number generator seed.
42
+ */
43
+ seed?: random.PRNGSeedMT19937;
44
+
45
+ /**
46
+ * Pseudorandom number generator state.
47
+ */
48
+ state?: random.PRNGStateMT19937;
49
+
50
+ /**
51
+ * Specifies whether to copy a provided pseudorandom number generator state. Default: true.
52
+ */
53
+ copy?: boolean;
54
+ }
55
+
56
+ /**
57
+ * Interface defining factory options.
58
+ */
59
+ interface FactoryOptions extends PRNGOptions {
60
+ /**
61
+ * Default output array data type. Default: 'float64'.
62
+ */
63
+ dtype?: DataType;
64
+ }
65
+
66
+ /**
67
+ * Interface defining options.
68
+ */
69
+ interface Options {
70
+ /**
71
+ * Output array data type.
72
+ */
73
+ dtype?: DataType;
74
+ }
75
+
76
+ /**
77
+ * Interface for PRNG properties and methods.
78
+ */
79
+ interface PRNG {
80
+ /**
81
+ * Underlying pseudorandom number generator.
82
+ */
83
+ readonly PRNG: random.PRNG;
84
+
85
+ /**
86
+ * PRNG seed.
87
+ */
88
+ readonly seed: random.PRNGSeedMT19937 | null;
89
+
90
+ /**
91
+ * PRNG seed length.
92
+ */
93
+ readonly seedLength: number | null;
94
+
95
+ /**
96
+ * PRNG state.
97
+ */
98
+ state: random.PRNGStateMT19937 | null;
99
+
100
+ /**
101
+ * PRNG state length.
102
+ */
103
+ readonly stateLength: number | null;
104
+
105
+ /**
106
+ * PRNG state size (in bytes).
107
+ */
108
+ readonly byteLength: number | null;
109
+ }
110
+
111
+ /**
112
+ * Interface for generating pseudorandom numbers drawn from Kumaraswamy's double bounded distribution with pre-specified parameter values.
113
+ */
114
+ interface UnaryFunction extends PRNG {
115
+ /**
116
+ * Returns an array containing pseudorandom numbers drawn from Kumaraswamy's double bounded distribution.
117
+ *
118
+ * @param len - array length
119
+ * @param options - function options
120
+ * @returns output array
121
+ */
122
+ ( len: number, options?: Options ): RandomArray;
123
+
124
+ /**
125
+ * Fills an array with pseudorandom numbers drawn from Kumaraswamy's double bounded distribution.
126
+ *
127
+ * @param out - output array
128
+ * @returns output array
129
+ */
130
+ assign( out: RandomArray ): RandomArray;
131
+ }
132
+
133
+ /**
134
+ * Interface for generating pseudorandom numbers drawn from Kumaraswamy's double bounded distribution without pre-specified parameter values.
135
+ */
136
+ interface TernaryFunction extends PRNG {
137
+ /**
138
+ * Returns an array containing pseudorandom numbers drawn from Kumaraswamy's double bounded distribution.
139
+ *
140
+ * @param len - array length
141
+ * @param a - first shape parameter
142
+ * @param b - second shape parameter
143
+ * @param options - function options
144
+ * @returns output array
145
+ */
146
+ ( len: number, a: number, b: number, options?: Options ): RandomArray;
147
+
148
+ /**
149
+ * Fills an array with pseudorandom numbers drawn from Kumaraswamy's double bounded distribution.
150
+ *
151
+ * @param a - first shape parameter
152
+ * @param b - second shape parameter
153
+ * @param out - output array
154
+ * @returns output array
155
+ */
156
+ assign( a: number, b: number, out: RandomArray ): RandomArray;
157
+ }
158
+
159
+ /**
160
+ * Interface for generating pseudorandom numbers drawn from Kumaraswamy's double bounded distribution.
161
+ */
162
+ interface Random extends PRNG {
163
+ /**
164
+ * Returns an array containing pseudorandom numbers drawn from Kumaraswamy's double bounded distribution.
165
+ *
166
+ * @param len - array length
167
+ * @param a - first shape parameter
168
+ * @param b - second shape parameter
169
+ * @param options - function options
170
+ * @returns output array
171
+ *
172
+ * @example
173
+ * var out = kumaraswamy( 10, 2.0, 5.0 );
174
+ * // returns <Float64Array>
175
+ */
176
+ ( len: number, a: number, b: number, options?: Options ): RandomArray;
177
+
178
+ /**
179
+ * Fills an array with pseudorandom numbers drawn from Kumaraswamy's double bounded distribution.
180
+ *
181
+ * @param a - first shape parameter
182
+ * @param b - second shape parameter
183
+ * @param out - output array
184
+ * @returns output array
185
+ *
186
+ * @example
187
+ * var zeros = require( '@stdlib/array-zeros' );
188
+ *
189
+ * var x = zeros( 10, 'float64' );
190
+ * // returns <Float64Array>
191
+ *
192
+ * var out = kumaraswamy( 2.0, 5.0, out );
193
+ * // returns <Float64Array>
194
+ *
195
+ * var bool = ( out === x );
196
+ * // returns true
197
+ */
198
+ assign( a: number, b: number, out: RandomArray ): RandomArray;
199
+
200
+ /**
201
+ * Returns a function for creating arrays containing pseudorandom numbers drawn from Kumaraswamy's double bounded distribution.
202
+ *
203
+ * ## Notes
204
+ *
205
+ * - When provided distribution parameters, the returned function returns random variates drawn from the specified distribution.
206
+ *
207
+ * @param a - first shape parameter
208
+ * @param b - second shape parameter
209
+ * @param options - function options
210
+ * @throws must provide a valid state
211
+ * @returns function for creating arrays
212
+ *
213
+ * @example
214
+ * var random = kumaraswamy.factory( 2.0, 5.0 );
215
+ *
216
+ * var out = random( 10 );
217
+ * // returns <Float64Array>
218
+ *
219
+ * @example
220
+ * var random = kumaraswamy.factory( 2.0, 5.0, {
221
+ * 'seed': 297
222
+ * });
223
+ * var out = random( 10 );
224
+ * // returns <Float64Array>
225
+ */
226
+ factory( a: number, b: number, options?: FactoryOptions ): UnaryFunction;
227
+
228
+ /**
229
+ * Returns a function for creating arrays containing pseudorandom numbers drawn from Kumaraswamy's double bounded distribution.
230
+ *
231
+ * ## Notes
232
+ *
233
+ * - When not provided distribution parameters, the returned function requires that distribution parameters be provided at each invocation.
234
+ *
235
+ * @param options - function options
236
+ * @throws must provide a valid state
237
+ * @returns function for creating arrays
238
+ *
239
+ * @example
240
+ * var random = kumaraswamy.factory();
241
+ *
242
+ * var out = random( 10, 2.0, 5.0 );
243
+ * // returns <Float64Array>
244
+ *
245
+ * @example
246
+ * var random = kumaraswamy.factory({
247
+ * 'seed': 297
248
+ * });
249
+ * var out = random( 10, 2.0, 5.0 );
250
+ * // returns <Float64Array>
251
+ */
252
+ factory( options?: FactoryOptions ): TernaryFunction;
253
+ }
254
+
255
+ /**
256
+ * Returns an array containing pseudorandom numbers drawn from Kumaraswamy's double bounded distribution.
257
+ *
258
+ * @param len - array length
259
+ * @param a - first shape parameter
260
+ * @param b - second shape parameter
261
+ * @param options - function options
262
+ * @returns output array
263
+ *
264
+ * @example
265
+ * var out = kumaraswamy( 10, 2.0, 5.0 );
266
+ * // returns <Float64Array>
267
+ *
268
+ * @example
269
+ * var random = kumaraswamy.factory( 2.0, 5.0 );
270
+ *
271
+ * var out = random( 10 );
272
+ * // returns <Float64Array>
273
+ */
274
+ declare var kumaraswamy: Random;
275
+
276
+
277
+ // EXPORTS //
278
+
279
+ export = kumaraswamy;
package/lib/factory.js ADDED
@@ -0,0 +1,77 @@
1
+ /**
2
+ * @license Apache-2.0
3
+ *
4
+ * Copyright (c) 2024 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
+
19
+ 'use strict';
20
+
21
+ // MODULES //
22
+
23
+ var binaryFactory = require( '@stdlib/random-array-tools-binary-factory' );
24
+ var dtypes = require( '@stdlib/array-dtypes' );
25
+ var defaults = require( '@stdlib/array-defaults' );
26
+ var base = require( '@stdlib/random-base-kumaraswamy' );
27
+
28
+
29
+ // VARIABLES //
30
+
31
+ var DTYPES = dtypes( 'real_floating_point_and_generic' );
32
+
33
+
34
+ // MAIN //
35
+
36
+ /**
37
+ * Returns a function for creating arrays containing pseudorandom numbers drawn from Kumaraswamy's double bounded distribution.
38
+ *
39
+ * @name factory
40
+ * @type {Function}
41
+ * @param {PositiveNumber} [a] - first shape parameter
42
+ * @param {PositiveNumber} [b] - second shape parameter
43
+ * @param {Options} [options] - function options
44
+ * @param {PRNG} [options.prng] - pseudorandom number generator which generates uniformly distributed pseudorandom numbers
45
+ * @param {PRNGSeedMT19937} [options.seed] - pseudorandom number generator seed
46
+ * @param {PRNGStateMT19937} [options.state] - pseudorandom number generator state
47
+ * @param {boolean} [options.copy=true] - boolean indicating whether to copy a provided pseudorandom number generator state
48
+ * @param {string} [options.dtype="float64"] - default data type
49
+ * @throws {TypeError} `a` must be a positive number
50
+ * @throws {TypeError} `b` must be a positive number
51
+ * @throws {TypeError} options argument must be an object
52
+ * @throws {TypeError} must provide valid options
53
+ * @throws {Error} must provide a valid state
54
+ * @returns {Function} function for creating arrays
55
+ *
56
+ * @example
57
+ * var kumaraswamy = factory( 2.0, 5.0 );
58
+ * // returns <Function>
59
+ *
60
+ * var arr = kumaraswamy( 10 );
61
+ * // returns <Float64Array>
62
+ *
63
+ * @example
64
+ * var kumaraswamy = factory( 2.0, 5.0 );
65
+ * // returns <Function>
66
+ *
67
+ * var arr = kumaraswamy( 10, {
68
+ * 'dtype': 'generic'
69
+ * });
70
+ * // returns [...]
71
+ */
72
+ var factory = binaryFactory( base, DTYPES, defaults.get( 'dtypes.real_floating_point' ) );
73
+
74
+
75
+ // EXPORTS //
76
+
77
+ module.exports = factory;
package/lib/index.js ADDED
@@ -0,0 +1,77 @@
1
+ /**
2
+ * @license Apache-2.0
3
+ *
4
+ * Copyright (c) 2024 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
+
19
+ 'use strict';
20
+
21
+ /**
22
+ * Create an array containing pseudorandom numbers drawn from Kumaraswamy's double bounded distribution.
23
+ *
24
+ * @module @stdlib/random-array-kumaraswamy
25
+ *
26
+ * @example
27
+ * var kumaraswamy = require( '@stdlib/random-array-kumaraswamy' );
28
+ *
29
+ * var arr = kumaraswamy( 10, 2.0, 5.0 );
30
+ * // returns <Float64Array>
31
+ *
32
+ * @example
33
+ * var kumaraswamy = require( '@stdlib/random-array-kumaraswamy' );
34
+ *
35
+ * var arr = kumaraswamy( 10, 2.0, 5.0, {
36
+ * 'dtype': 'generic'
37
+ * });
38
+ * // returns [...]
39
+ *
40
+ * @example
41
+ * var kumaraswamy = require( '@stdlib/random-array-kumaraswamy' );
42
+ *
43
+ * var rand = kumaraswamy.factory( 2.0, 5.0 );
44
+ * // returns <Function>
45
+ *
46
+ * var arr = rand( 10 );
47
+ * // returns <Float64Array>
48
+ *
49
+ * @example
50
+ * var kumaraswamy = require( '@stdlib/random-array-kumaraswamy' );
51
+ *
52
+ * var rand = kumaraswamy.factory( 2.0, 5.0 );
53
+ * // returns <Function>
54
+ *
55
+ * var arr = rand( 10, {
56
+ * 'dtype': 'generic'
57
+ * });
58
+ * // returns [...]
59
+ */
60
+
61
+ // MODULES //
62
+
63
+ var setReadOnly = require( '@stdlib/utils-define-nonenumerable-read-only-property' );
64
+ var main = require( './main.js' );
65
+ var factory = require( './factory.js' );
66
+
67
+
68
+ // MAIN //
69
+
70
+ setReadOnly( main, 'factory', factory );
71
+
72
+
73
+ // EXPORTS //
74
+
75
+ module.exports = main;
76
+
77
+ // exports: { "factory": "main.factory", "assign": "main.assign" }
package/lib/main.js ADDED
@@ -0,0 +1,58 @@
1
+ /**
2
+ * @license Apache-2.0
3
+ *
4
+ * Copyright (c) 2024 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
+
19
+ 'use strict';
20
+
21
+ // MODULES //
22
+
23
+ var factory = require( './factory.js' );
24
+
25
+
26
+ // MAIN //
27
+
28
+ /**
29
+ * Returns an array containing pseudorandom numbers drawn from Kumaraswamy's double bounded distribution.
30
+ *
31
+ * @name kumaraswamy
32
+ * @type {Function}
33
+ * @param {NonNegativeInteger} len - array length
34
+ * @param {PositiveNumber} a - first shape parameter
35
+ * @param {PositiveNumber} b - second shape parameter
36
+ * @param {Options} [options] - options
37
+ * @param {string} [options.dtype="float64"] - output array data type
38
+ * @throws {TypeError} first argument must be a nonnegative integer
39
+ * @throws {TypeError} options argument must be an object
40
+ * @throws {TypeError} must provide valid options
41
+ * @returns {(Array|TypedArray)} output array
42
+ *
43
+ * @example
44
+ * var arr = kumaraswamy( 10, 2.0, 5.0 );
45
+ * // returns <Float64Array>
46
+ *
47
+ * @example
48
+ * var arr = kumaraswamy( 10, 2.0, 5.0, {
49
+ * 'dtype': 'generic'
50
+ * });
51
+ * // returns [...]
52
+ */
53
+ var kumaraswamy = factory();
54
+
55
+
56
+ // EXPORTS //
57
+
58
+ module.exports = kumaraswamy;
package/package.json ADDED
@@ -0,0 +1,105 @@
1
+ {
2
+ "name": "@stdlib/random-array-kumaraswamy",
3
+ "version": "0.1.0",
4
+ "description": "Create an array containing pseudorandom numbers drawn from Kumaraswamy's double bounded distribution.",
5
+ "license": "Apache-2.0",
6
+ "author": {
7
+ "name": "The Stdlib Authors",
8
+ "url": "https://github.com/stdlib-js/stdlib/graphs/contributors"
9
+ },
10
+ "contributors": [
11
+ {
12
+ "name": "The Stdlib Authors",
13
+ "url": "https://github.com/stdlib-js/stdlib/graphs/contributors"
14
+ }
15
+ ],
16
+ "main": "./lib",
17
+ "directories": {
18
+ "benchmark": "./benchmark",
19
+ "doc": "./docs",
20
+ "example": "./examples",
21
+ "lib": "./lib",
22
+ "test": "./test"
23
+ },
24
+ "types": "./docs/types",
25
+ "scripts": {
26
+ "test": "make test",
27
+ "test-cov": "make test-cov",
28
+ "examples": "make examples",
29
+ "benchmark": "make benchmark"
30
+ },
31
+ "homepage": "https://stdlib.io",
32
+ "repository": {
33
+ "type": "git",
34
+ "url": "git://github.com/stdlib-js/random-array-kumaraswamy.git"
35
+ },
36
+ "bugs": {
37
+ "url": "https://github.com/stdlib-js/stdlib/issues"
38
+ },
39
+ "dependencies": {
40
+ "@stdlib/array-defaults": "^0.1.0",
41
+ "@stdlib/array-dtypes": "^0.1.0",
42
+ "@stdlib/random-array-tools-binary-factory": "^0.1.0",
43
+ "@stdlib/random-base-kumaraswamy": "^0.1.0",
44
+ "@stdlib/types": "^0.2.0",
45
+ "@stdlib/utils-define-nonenumerable-read-only-property": "^0.1.1"
46
+ },
47
+ "devDependencies": {
48
+ "@stdlib/array-float32": "^0.1.1",
49
+ "@stdlib/array-float64": "^0.1.1",
50
+ "@stdlib/array-nans": "^0.1.0",
51
+ "@stdlib/array-uint32": "^0.1.1",
52
+ "@stdlib/array-zeros": "^0.1.0",
53
+ "@stdlib/assert-is-uint32array": "^0.1.1",
54
+ "@stdlib/console-log-each": "^0.1.0",
55
+ "@stdlib/constants-uint32-max": "^0.1.1",
56
+ "@stdlib/math-base-assert-is-nan": "^0.1.1",
57
+ "@stdlib/math-base-assert-is-nanf": "^0.1.1",
58
+ "@stdlib/math-base-special-pow": "^0.1.0",
59
+ "@stdlib/random-base-minstd": "^0.1.0",
60
+ "tape": "git+https://github.com/kgryte/tape.git#fix/globby",
61
+ "istanbul": "^0.4.1",
62
+ "tap-min": "git+https://github.com/Planeshifter/tap-min.git",
63
+ "@stdlib/bench-harness": "^0.1.2",
64
+ "@stdlib/bench": "^0.2.1"
65
+ },
66
+ "engines": {
67
+ "node": ">=0.10.0",
68
+ "npm": ">2.7.0"
69
+ },
70
+ "os": [
71
+ "aix",
72
+ "darwin",
73
+ "freebsd",
74
+ "linux",
75
+ "macos",
76
+ "openbsd",
77
+ "sunos",
78
+ "win32",
79
+ "windows"
80
+ ],
81
+ "keywords": [
82
+ "stdlib",
83
+ "stdmath",
84
+ "mathematics",
85
+ "math",
86
+ "statistics",
87
+ "stats",
88
+ "prng",
89
+ "rng",
90
+ "pseudorandom",
91
+ "random",
92
+ "rand",
93
+ "kumaraswamy",
94
+ "continuous",
95
+ "generator",
96
+ "seed",
97
+ "seedable",
98
+ "array",
99
+ "vector"
100
+ ],
101
+ "funding": {
102
+ "type": "opencollective",
103
+ "url": "https://opencollective.com/stdlib"
104
+ }
105
+ }