@stdlib/random-base-laplace 0.0.6 → 0.2.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 CHANGED
@@ -175,307 +175,3 @@
175
175
  of your accepting any such warranty or additional liability.
176
176
 
177
177
  END OF TERMS AND CONDITIONS
178
-
179
-
180
-
181
- Boost Software License - Version 1.0 - August 17th, 2003
182
-
183
- Permission is hereby granted, free of charge, to any person or organization
184
- obtaining a copy of the software and accompanying documentation covered by this
185
- license (the "Software") to use, reproduce, display, distribute, execute, and
186
- transmit the Software, and to prepare derivative works of the Software, and to
187
- permit third-parties to whom the Software is furnished to do so, all subject to
188
- the following:
189
-
190
- The copyright notices in the Software and this entire statement, including the
191
- above license grant, this restriction and the following disclaimer, must be
192
- included in all copies of the Software, in whole or in part, and all derivative
193
- works of the Software, unless such copies or derivative works are solely in the
194
- form of machine-executable object code generated by a source language processor.
195
-
196
- THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
197
- IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS
198
- FOR A PARTICULAR PURPOSE, TITLE AND NON-INFRINGEMENT. IN NO EVENT SHALL THE
199
- COPYRIGHT HOLDERS OR ANYONE DISTRIBUTING THE SOFTWARE BE LIABLE FOR ANY DAMAGES
200
- OR OTHER LIABILITY, WHETHER IN CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF
201
- OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
202
-
203
-
204
-
205
-
206
- DEPENDENCIES
207
-
208
- The library links against the following external libraries, which have their own
209
- licenses:
210
-
211
- * OpenBLAS <https://raw.githubusercontent.com/xianyi/OpenBLAS/
212
- def146efed8d5908ea04e22668feeab7099599a0/LICENSE>
213
-
214
- Copyright (c) 2011-2014, The OpenBLAS Project
215
- All rights reserved.
216
-
217
- Redistribution and use in source and binary forms, with or without
218
- modification, are permitted provided that the following conditions are
219
- met:
220
-
221
- 1. Redistributions of source code must retain the above copyright
222
- notice, this list of conditions and the following disclaimer.
223
-
224
- 2. Redistributions in binary form must reproduce the above copyright
225
- notice, this list of conditions and the following disclaimer in
226
- the documentation and/or other materials provided with the
227
- distribution.
228
-
229
- 3. Neither the name of the OpenBLAS project nor the names of
230
- its contributors may be used to endorse or promote products
231
- derived from this software without specific prior written
232
- permission.
233
-
234
- THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
235
- AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
236
- IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
237
- ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE
238
- LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
239
- CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE
240
- GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
241
- HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
242
- LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF
243
- THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
244
-
245
-
246
- * Electron <https://raw.githubusercontent.com/electron/electron/
247
- c4cfb3e7110266b9d7ad80e1ae097c4db564501c/LICENSE>
248
-
249
- Copyright (c) 2013-2017 GitHub Inc.
250
-
251
- Permission is hereby granted, free of charge, to any person obtaining
252
- a copy of this software and associated documentation files (the
253
- "Software"), to deal in the Software without restriction, including
254
- without limitation the rights to use, copy, modify, merge, publish,
255
- distribute, sublicense, and/or sell copies of the Software, and to
256
- permit persons to whom the Software is furnished to do so, subject to
257
- the following conditions:
258
-
259
- The above copyright notice and this permission notice shall be
260
- included in all copies or substantial portions of the Software.
261
-
262
- THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
263
- EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
264
- MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
265
- NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
266
- LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
267
- OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
268
- WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
269
-
270
-
271
- * Boost <http://www.boost.org/LICENSE_1_0.txt>
272
-
273
- Boost Software License - Version 1.0 - August 17th, 2003
274
-
275
- Permission is hereby granted, free of charge, to any person or organization
276
- obtaining a copy of the software and accompanying documentation covered by
277
- this license (the "Software") to use, reproduce, display, distribute,
278
- execute, and transmit the Software, and to prepare derivative works of the
279
- Software, and to permit third-parties to whom the Software is furnished to
280
- do so, all subject to the following:
281
-
282
- The copyright notices in the Software and this entire statement, including
283
- the above license grant, this restriction and the following disclaimer,
284
- must be included in all copies of the Software, in whole or in part, and
285
- all derivative works of the Software, unless such copies or derivative
286
- works are solely in the form of machine-executable object code generated by
287
- a source language processor.
288
-
289
- THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
290
- IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
291
- FITNESS FOR A PARTICULAR PURPOSE, TITLE AND NON-INFRINGEMENT. IN NO EVENT
292
- SHALL THE COPYRIGHT HOLDERS OR ANYONE DISTRIBUTING THE SOFTWARE BE LIABLE
293
- FOR ANY DAMAGES OR OTHER LIABILITY, WHETHER IN CONTRACT, TORT OR OTHERWISE,
294
- ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
295
- DEALINGS IN THE SOFTWARE.
296
-
297
-
298
- * Cephes <http://www.netlib.org/cephes/readme>
299
-
300
- Copyright (c) 1984-2000 Stephen L. Moshier
301
-
302
- Some software in this archive may be from the book _Methods and Programs for
303
- Mathematical Functions_ (Prentice-Hall or Simon & Schuster International, 1989)
304
- or from the Cephes Mathematical Library, a commercial product. In either event,
305
- it is copyrighted by the author. What you see here may be used freely but it
306
- comes with no support or guarantee.
307
-
308
- Stephen L. Moshier
309
- moshier@na-net.ornl.gov
310
-
311
-
312
-
313
- ATTRIBUTION
314
-
315
- The library contains implementations from the following external libraries,
316
- which have their own licenses:
317
-
318
- * FreeBSD <https://svnweb.freebsd.org/>
319
-
320
- Copyright (C) 1993-2004 by Sun Microsystems, Inc. All rights reserved.
321
-
322
- Developed at SunPro, a Sun Microsystems, Inc. business.
323
- Permission to use, copy, modify, and distribute this
324
- software is freely granted, provided that this notice
325
- is preserved.
326
-
327
-
328
- * FDLIBM <http://www.netlib.org/fdlibm/>
329
-
330
- Copyright (C) 2004 by Sun Microsystems, Inc. All rights reserved.
331
-
332
- Developed at SunPro, a Sun Microsystems, Inc. business.
333
- Permission to use, copy, modify, and distribute this
334
- software is freely granted, provided that this notice
335
- is preserved.
336
-
337
-
338
- * Go <https://raw.githubusercontent.com/golang/go/master/LICENSE>
339
-
340
- Copyright (c) 2009 The Go Authors. All rights reserved.
341
-
342
- Redistribution and use in source and binary forms, with or without
343
- modification, are permitted provided that the following conditions are
344
- met:
345
-
346
- * Redistributions of source code must retain the above copyright
347
- notice, this list of conditions and the following disclaimer.
348
- * Redistributions in binary form must reproduce the above
349
- copyright notice, this list of conditions and the following disclaimer
350
- in the documentation and/or other materials provided with the
351
- distribution.
352
- * Neither the name of Google Inc. nor the names of its
353
- contributors may be used to endorse or promote products derived from
354
- this software without specific prior written permission.
355
-
356
- THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
357
- "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
358
- LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
359
- A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
360
- OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
361
- SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
362
- LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
363
- DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
364
- THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
365
- (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
366
- OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
367
-
368
-
369
- * SLATEC Common Mathematical Library <http://www.netlib.no/netlib/slatec/>
370
-
371
- Public domain.
372
-
373
-
374
- * ESLint <https://raw.githubusercontent.com/eslint/eslint/master/LICENSE>
375
-
376
- Copyright JS Foundation and other contributors, https://js.foundation
377
-
378
- Permission is hereby granted, free of charge, to any person obtaining a copy
379
- of this software and associated documentation files (the "Software"), to deal
380
- in the Software without restriction, including without limitation the rights
381
- to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
382
- copies of the Software, and to permit persons to whom the Software is
383
- furnished to do so, subject to the following conditions:
384
-
385
- The above copyright notice and this permission notice shall be included in
386
- all copies or substantial portions of the Software.
387
-
388
- THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
389
- IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
390
- FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
391
- AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
392
- LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
393
- OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
394
- THE SOFTWARE.
395
-
396
-
397
- * StatsFuns.jl <https://raw.githubusercontent.com/JuliaStats/StatsFuns.jl/
398
- e66dd973650c375bc1739c820e5b96bb5bd000a8/LICENSE.md>
399
-
400
- Copyright (c) 2015: Dahua Lin.
401
-
402
- Permission is hereby granted, free of charge, to any person obtaining
403
- a copy of this software and associated documentation files (the
404
- "Software"), to deal in the Software without restriction, including
405
- without limitation the rights to use, copy, modify, merge, publish,
406
- distribute, sublicense, and/or sell copies of the Software, and to
407
- permit persons to whom the Software is furnished to do so, subject to
408
- the following conditions:
409
-
410
- The above copyright notice and this permission notice shall be
411
- included in all copies or substantial portions of the Software.
412
-
413
- THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
414
- EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
415
- MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
416
- IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY
417
- CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT,
418
- TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE
419
- SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
420
-
421
-
422
- * SpecialFunctions.jl <https://raw.githubusercontent.com/JuliaMath/
423
- SpecialFunctions.jl/02a173fbe24a61c4b392aec17a9764ac5727feb1/LICENSE>
424
-
425
- The MIT License (MIT)
426
-
427
- Copyright (c) 2017 Jeff Bezanson, Stefan Karpinski, Viral B. Shah, and others:
428
-
429
- https://github.com/JuliaMath/SpecialFunctions.jl/graphs/contributors
430
-
431
- Permission is hereby granted, free of charge, to any person obtaining a copy
432
- of this software and associated documentation files (the "Software"), to deal
433
- in the Software without restriction, including without limitation the rights
434
- to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
435
- copies of the Software, and to permit persons to whom the Software is
436
- furnished to do so, subject to the following conditions:
437
-
438
- The above copyright notice and this permission notice shall be included in all
439
- copies or substantial portions of the Software.
440
-
441
- THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
442
- IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
443
- FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
444
- AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
445
- LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
446
- OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
447
- SOFTWARE.
448
-
449
-
450
- * MT19937 <http://www.math.sci.hiroshima-u.ac.jp/~m-mat/MT/MT2002/CODES/
451
- mt19937ar.c>
452
-
453
- Copyright (C) 1997 - 2002, Makoto Matsumoto and Takuji Nishimura,
454
- All rights reserved.
455
-
456
- Redistribution and use in source and binary forms, with or without
457
- modification, are permitted provided that the following conditions
458
- are met:
459
-
460
- 1. Redistributions of source code must retain the above copyright
461
- notice, this list of conditions and the following disclaimer.
462
-
463
- 2. Redistributions in binary form must reproduce the above copyright
464
- notice, this list of conditions and the following disclaimer in the
465
- documentation and/or other materials provided with the distribution.
466
-
467
- 3. The names of its contributors may not be used to endorse or promote
468
- products derived from this software without specific prior written
469
- permission.
470
-
471
- THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
472
- "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
473
- LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
474
- A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
475
- OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
476
- SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
477
- LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
478
- DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
479
- THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
480
- (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
481
- OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
package/NOTICE CHANGED
@@ -1 +1 @@
1
- Copyright (c) 2016-2022 The Stdlib Authors.
1
+ Copyright (c) 2016-2024 The Stdlib Authors.
package/README.md CHANGED
@@ -18,6 +18,17 @@ limitations under the License.
18
18
 
19
19
  -->
20
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
+
21
32
  # Laplace Random Numbers
22
33
 
23
34
  [![NPM version][npm-image]][npm-url] [![Build Status][test-image]][test-url] [![Coverage Status][coverage-image]][coverage-url] <!-- [![dependencies][dependencies-image]][dependencies-url] -->
@@ -413,6 +424,14 @@ for ( i = 0; i < 100; i++ ) {
413
424
 
414
425
  <section class="related">
415
426
 
427
+ * * *
428
+
429
+ ## See Also
430
+
431
+ - <span class="package-name">[`@stdlib/random-array/laplace`][@stdlib/random/array/laplace]</span><span class="delimiter">: </span><span class="description">create an array containing pseudorandom numbers drawn from a Laplace (double exponential) distribution.</span>
432
+ - <span class="package-name">[`@stdlib/random-iter/laplace`][@stdlib/random/iter/laplace]</span><span class="delimiter">: </span><span class="description">create an iterator for generating pseudorandom numbers drawn from a Laplace distribution.</span>
433
+ - <span class="package-name">[`@stdlib/random-streams/laplace`][@stdlib/random/streams/laplace]</span><span class="delimiter">: </span><span class="description">create a readable stream for generating pseudorandom numbers drawn from a Laplace (double exponential) distribution.</span>
434
+
416
435
  </section>
417
436
 
418
437
  <!-- /.related -->
@@ -443,7 +462,7 @@ See [LICENSE][stdlib-license].
443
462
 
444
463
  ## Copyright
445
464
 
446
- Copyright &copy; 2016-2022. The Stdlib [Authors][stdlib-authors].
465
+ Copyright &copy; 2016-2024. The Stdlib [Authors][stdlib-authors].
447
466
 
448
467
  </section>
449
468
 
@@ -456,8 +475,8 @@ Copyright &copy; 2016-2022. The Stdlib [Authors][stdlib-authors].
456
475
  [npm-image]: http://img.shields.io/npm/v/@stdlib/random-base-laplace.svg
457
476
  [npm-url]: https://npmjs.org/package/@stdlib/random-base-laplace
458
477
 
459
- [test-image]: https://github.com/stdlib-js/random-base-laplace/actions/workflows/test.yml/badge.svg
460
- [test-url]: https://github.com/stdlib-js/random-base-laplace/actions/workflows/test.yml
478
+ [test-image]: https://github.com/stdlib-js/random-base-laplace/actions/workflows/test.yml/badge.svg?branch=v0.2.0
479
+ [test-url]: https://github.com/stdlib-js/random-base-laplace/actions/workflows/test.yml?query=branch:v0.2.0
461
480
 
462
481
  [coverage-image]: https://img.shields.io/codecov/c/github/stdlib-js/random-base-laplace/main.svg
463
482
  [coverage-url]: https://codecov.io/github/stdlib-js/random-base-laplace?branch=main
@@ -469,19 +488,23 @@ Copyright &copy; 2016-2022. The Stdlib [Authors][stdlib-authors].
469
488
 
470
489
  -->
471
490
 
491
+ [chat-image]: https://img.shields.io/gitter/room/stdlib-js/stdlib.svg
492
+ [chat-url]: https://app.gitter.im/#/room/#stdlib-js_stdlib:gitter.im
493
+
494
+ [stdlib]: https://github.com/stdlib-js/stdlib
495
+
496
+ [stdlib-authors]: https://github.com/stdlib-js/stdlib/graphs/contributors
497
+
472
498
  [umd]: https://github.com/umdjs/umd
473
499
  [es-module]: https://developer.mozilla.org/en-US/docs/Web/JavaScript/Guide/Modules
474
500
 
475
501
  [deno-url]: https://github.com/stdlib-js/random-base-laplace/tree/deno
502
+ [deno-readme]: https://github.com/stdlib-js/random-base-laplace/blob/deno/README.md
476
503
  [umd-url]: https://github.com/stdlib-js/random-base-laplace/tree/umd
504
+ [umd-readme]: https://github.com/stdlib-js/random-base-laplace/blob/umd/README.md
477
505
  [esm-url]: https://github.com/stdlib-js/random-base-laplace/tree/esm
478
-
479
- [chat-image]: https://img.shields.io/gitter/room/stdlib-js/stdlib.svg
480
- [chat-url]: https://gitter.im/stdlib-js/stdlib/
481
-
482
- [stdlib]: https://github.com/stdlib-js/stdlib
483
-
484
- [stdlib-authors]: https://github.com/stdlib-js/stdlib/graphs/contributors
506
+ [esm-readme]: https://github.com/stdlib-js/random-base-laplace/blob/esm/README.md
507
+ [branches-url]: https://github.com/stdlib-js/random-base-laplace/blob/main/branches.md
485
508
 
486
509
  [stdlib-license]: https://raw.githubusercontent.com/stdlib-js/random-base-laplace/main/LICENSE
487
510
 
@@ -489,6 +512,16 @@ Copyright &copy; 2016-2022. The Stdlib [Authors][stdlib-authors].
489
512
 
490
513
  [@stdlib/array/uint32]: https://www.npmjs.com/package/@stdlib/array-uint32
491
514
 
515
+ <!-- <related-links> -->
516
+
517
+ [@stdlib/random/array/laplace]: https://www.npmjs.com/package/@stdlib/random-array-laplace
518
+
519
+ [@stdlib/random/iter/laplace]: https://www.npmjs.com/package/@stdlib/random-iter-laplace
520
+
521
+ [@stdlib/random/streams/laplace]: https://www.npmjs.com/package/@stdlib/random-streams-laplace
522
+
523
+ <!-- </related-links> -->
524
+
492
525
  </section>
493
526
 
494
527
  <!-- /.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 laplace from '../docs/types/index';
3
+ export = laplace;
package/dist/index.js ADDED
@@ -0,0 +1,11 @@
1
+ "use strict";var o=function(r,e){return function(){return e||r((e={exports:{}}).exports,e),e.exports}};var d=o(function(te,m){
2
+ var W=require('@stdlib/assert-is-number/dist').isPrimitive,k=require('@stdlib/assert-is-positive-number/dist').isPrimitive,f=require('@stdlib/error-tools-fmtprodmsg/dist'),B=require('@stdlib/assert-is-nan/dist');function C(r,e){return !W(r)||B(r)?new TypeError(f('0oZ6v',r)):k(e)?null:new TypeError(f('0oZ72',e));}m.exports=C
3
+ });var h=o(function(ne,q){
4
+ var D=require('@stdlib/math-base-special-signum/dist'),H=require('@stdlib/math-base-special-abs/dist'),I=require('@stdlib/math-base-special-ln/dist');function K(r,e,t){var i=r()-.5;return e-t*D(i)*I(1-2*H(i))}q.exports=K
5
+ });var c=o(function(ae,E){
6
+ var a=require('@stdlib/utils-define-nonenumerable-read-only-property/dist'),l=require('@stdlib/utils-define-nonenumerable-read-only-accessor/dist'),y=require('@stdlib/utils-define-nonenumerable-read-write-accessor/dist'),b=require('@stdlib/assert-is-plain-object/dist'),N=require('@stdlib/assert-is-function/dist'),w=require('@stdlib/assert-has-own-property/dist'),O=require('@stdlib/utils-constant-function/dist'),Q=require('@stdlib/utils-noop/dist'),g=require('@stdlib/random-base-mt19937/dist').factory,L=require('@stdlib/math-base-assert-is-nan/dist'),U=require('@stdlib/array-to-json/dist'),v=require('@stdlib/error-tools-fmtprodmsg/dist'),X=d(),S=h();function Y(){var r,e,t,i,u,s;if(arguments.length===0)e=g();else if(arguments.length===1){if(r=arguments[0],!b(r))throw new TypeError(v('0oZ2V',r));if(w(r,"prng")){if(!N(r.prng))throw new TypeError(v('0oZ6u',"prng",r.prng));e=r.prng}else e=g(r)}else{if(u=arguments[0],s=arguments[1],i=X(u,s),i)throw i;if(arguments.length>2){if(r=arguments[2],!b(r))throw new TypeError(v('0oZ2V',r));if(w(r,"prng")){if(!N(r.prng))throw new TypeError(v('0oZ6u',"prng",r.prng));e=r.prng}else e=g(r)}else e=g()}return u===void 0?t=M:t=z,a(t,"NAME","laplace"),r&&r.prng?(a(t,"seed",null),a(t,"seedLength",null),y(t,"state",O(null),Q),a(t,"stateLength",null),a(t,"byteLength",null),a(t,"toJSON",O(null)),a(t,"PRNG",e)):(l(t,"seed",x),l(t,"seedLength",j),y(t,"state",F,G),l(t,"stateLength",A),l(t,"byteLength",V),a(t,"toJSON",J),a(t,"PRNG",e),e=e.normalized),t;function x(){return e.seed}function j(){return e.seedLength}function A(){return e.stateLength}function V(){return e.byteLength}function F(){return e.state}function G(n){e.state=n}function J(){var n={};return n.type="PRNG",n.name=t.NAME,n.state=U(e.state),u===void 0?n.params=[]:n.params=[u,s],n}function z(){return S(e,u,s)}function M(n,p){return L(n)||L(p)||p<=0?NaN:S(e,n,p)}}E.exports=Y
7
+ });var R=o(function(ie,P){
8
+ var Z=c(),_=Z();P.exports=_
9
+ });var $=require('@stdlib/utils-define-nonenumerable-read-only-property/dist'),T=R(),ee=c();$(T,"factory",ee);module.exports=T;
10
+ /** @license Apache-2.0 */
11
+ //# sourceMappingURL=index.js.map
@@ -0,0 +1,7 @@
1
+ {
2
+ "version": 3,
3
+ "sources": ["../lib/validate.js", "../lib/laplace.js", "../lib/factory.js", "../lib/main.js", "../lib/index.js"],
4
+ "sourcesContent": ["/**\n* @license Apache-2.0\n*\n* Copyright (c) 2018 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 isNumber = require( '@stdlib/assert-is-number' ).isPrimitive;\nvar isPositive = require( '@stdlib/assert-is-positive-number' ).isPrimitive;\nvar format = require( '@stdlib/string-format' );\nvar isnan = require( '@stdlib/assert-is-nan' );\n\n\n// MAIN //\n\n/**\n* Validates parameters.\n*\n* @private\n* @param {number} mu - mean\n* @param {PositiveNumber} b - scale parameter\n* @returns {(Error|null)} error or null\n*\n* @example\n* var err = validate( 1.0, 2.0 );\n* if ( err ) {\n* throw err;\n* }\n*/\nfunction validate( mu, b ) {\n\tif ( !isNumber( mu ) || isnan( mu ) ) {\n\t\treturn new TypeError( format( 'invalid argument. First argument must be a number and not NaN. Value: `%s`.', mu ) );\n\t}\n\tif ( !isPositive( b ) ) {\n\t\treturn new TypeError( format( 'invalid argument. Second argument must be a positive number. Value: `%s`.', b ) );\n\t}\n\treturn null;\n}\n\n\n// EXPORTS //\n\nmodule.exports = validate;\n", "/**\n* @license Apache-2.0\n*\n* Copyright (c) 2018 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 sign = require( '@stdlib/math-base-special-signum' );\nvar abs = require( '@stdlib/math-base-special-abs' );\nvar ln = require( '@stdlib/math-base-special-ln' );\n\n\n// MAIN //\n\n/**\n* Returns a pseudorandom number drawn from a Laplace (double exponential) distribution.\n*\n* @private\n* @param {PRNG} rand - PRNG for uniformly distributed numbers\n* @param {number} mu - mean\n* @param {PositiveNumber} b - scale parameter\n* @returns {number} pseudorandom number\n*/\nfunction laplace( rand, mu, b ) {\n\tvar u = rand() - 0.5;\n\treturn mu - ( b*sign( u )*ln( 1.0 - (2.0*abs(u)) ) );\n}\n\n\n// EXPORTS //\n\nmodule.exports = laplace;\n", "/**\n* @license Apache-2.0\n*\n* Copyright (c) 2018 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 setReadOnly = require( '@stdlib/utils-define-nonenumerable-read-only-property' );\nvar setReadOnlyAccessor = require( '@stdlib/utils-define-nonenumerable-read-only-accessor' );\nvar setReadWriteAccessor = require( '@stdlib/utils-define-nonenumerable-read-write-accessor' );\nvar isObject = require( '@stdlib/assert-is-plain-object' );\nvar isFunction = require( '@stdlib/assert-is-function' );\nvar hasOwnProp = require( '@stdlib/assert-has-own-property' );\nvar constantFunction = require( '@stdlib/utils-constant-function' );\nvar noop = require( '@stdlib/utils-noop' );\nvar randu = require( '@stdlib/random-base-mt19937' ).factory;\nvar isnan = require( '@stdlib/math-base-assert-is-nan' );\nvar typedarray2json = require( '@stdlib/array-to-json' );\nvar format = require( '@stdlib/string-format' );\nvar validate = require( './validate.js' );\nvar laplace0 = require( './laplace.js' );\n\n\n// MAIN //\n\n/**\n* Returns a pseudorandom number generator for generating random numbers from a Laplace (double exponential) distribution.\n*\n* @param {number} [mu] - mean\n* @param {PositiveNumber} [b] - scale 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* @throws {TypeError} `mu` must be a 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 {PRNG} pseudorandom number generator\n*\n* @example\n* var laplace = factory( 0.0, 1.0 );\n* var v = laplace();\n* // returns <number>\n*\n* @example\n* var laplace = factory( -3.0, 0.5, {\n* 'seed': 297\n* });\n* var v = laplace();\n* // returns <number>\n*/\nfunction factory() {\n\tvar opts;\n\tvar rand;\n\tvar prng;\n\tvar err;\n\tvar mu;\n\tvar b;\n\n\tif ( arguments.length === 0 ) {\n\t\trand = randu();\n\t} else if ( arguments.length === 1 ) {\n\t\topts = arguments[ 0 ];\n\t\tif ( !isObject( opts ) ) {\n\t\t\tthrow new TypeError( format( 'invalid argument. Options argument must be an object. Value: `%s`.', opts ) );\n\t\t}\n\t\tif ( hasOwnProp( opts, 'prng' ) ) {\n\t\t\tif ( !isFunction( opts.prng ) ) {\n\t\t\t\tthrow new TypeError( format( 'invalid option. `%s` option must be a pseudorandom number generator function. Option: `%s`.', 'prng', opts.prng ) );\n\t\t\t}\n\t\t\trand = opts.prng;\n\t\t} else {\n\t\t\trand = randu( opts );\n\t\t}\n\t} else {\n\t\tmu = arguments[ 0 ];\n\t\tb = arguments[ 1 ];\n\t\terr = validate( mu, b );\n\t\tif ( err ) {\n\t\t\tthrow err;\n\t\t}\n\t\tif ( arguments.length > 2 ) {\n\t\t\topts = arguments[ 2 ];\n\t\t\tif ( !isObject( opts ) ) {\n\t\t\t\tthrow new TypeError( format( 'invalid argument. Options argument must be an object. Value: `%s`.', opts ) );\n\t\t\t}\n\t\t\tif ( hasOwnProp( opts, 'prng' ) ) {\n\t\t\t\tif ( !isFunction( opts.prng ) ) {\n\t\t\t\t\tthrow new TypeError( format( 'invalid option. `%s` option must be a pseudorandom number generator function. Option: `%s`.', 'prng', opts.prng ) );\n\t\t\t\t}\n\t\t\t\trand = opts.prng;\n\t\t\t} else {\n\t\t\t\trand = randu( opts );\n\t\t\t}\n\t\t} else {\n\t\t\trand = randu();\n\t\t}\n\t}\n\tif ( mu === void 0 ) {\n\t\tprng = laplace2;\n\t} else {\n\t\tprng = laplace1;\n\t}\n\tsetReadOnly( prng, 'NAME', 'laplace' );\n\n\t// If we are provided an \"external\" PRNG, we don't support getting or setting PRNG state, as we'd need to check for compatible state value types, etc, entailing considerable complexity.\n\tif ( opts && opts.prng ) {\n\t\tsetReadOnly( prng, 'seed', null );\n\t\tsetReadOnly( prng, 'seedLength', null );\n\t\tsetReadWriteAccessor( prng, 'state', constantFunction( null ), noop );\n\t\tsetReadOnly( prng, 'stateLength', null );\n\t\tsetReadOnly( prng, 'byteLength', null );\n\t\tsetReadOnly( prng, 'toJSON', constantFunction( null ) );\n\t\tsetReadOnly( prng, 'PRNG', rand );\n\t} else {\n\t\tsetReadOnlyAccessor( prng, 'seed', getSeed );\n\t\tsetReadOnlyAccessor( prng, 'seedLength', getSeedLength );\n\t\tsetReadWriteAccessor( prng, 'state', getState, setState );\n\t\tsetReadOnlyAccessor( prng, 'stateLength', getStateLength );\n\t\tsetReadOnlyAccessor( prng, 'byteLength', getStateSize );\n\t\tsetReadOnly( prng, 'toJSON', toJSON );\n\t\tsetReadOnly( prng, 'PRNG', rand );\n\t\trand = rand.normalized;\n\t}\n\treturn prng;\n\n\t/**\n\t* Returns the PRNG seed.\n\t*\n\t* @private\n\t* @returns {PRNGSeedMT19937} seed\n\t*/\n\tfunction getSeed() {\n\t\treturn rand.seed;\n\t}\n\n\t/**\n\t* Returns the PRNG seed length.\n\t*\n\t* @private\n\t* @returns {PositiveInteger} seed length\n\t*/\n\tfunction getSeedLength() {\n\t\treturn rand.seedLength;\n\t}\n\n\t/**\n\t* Returns the PRNG state length.\n\t*\n\t* @private\n\t* @returns {PositiveInteger} state length\n\t*/\n\tfunction getStateLength() {\n\t\treturn rand.stateLength;\n\t}\n\n\t/**\n\t* Returns the PRNG state size (in bytes).\n\t*\n\t* @private\n\t* @returns {PositiveInteger} state size (in bytes)\n\t*/\n\tfunction getStateSize() {\n\t\treturn rand.byteLength;\n\t}\n\n\t/**\n\t* Returns the current pseudorandom number generator state.\n\t*\n\t* @private\n\t* @returns {PRNGStateMT19937} current state\n\t*/\n\tfunction getState() {\n\t\treturn rand.state;\n\t}\n\n\t/**\n\t* Sets the pseudorandom number generator state.\n\t*\n\t* @private\n\t* @param {PRNGStateMT19937} s - generator state\n\t* @throws {Error} must provide a valid state\n\t*/\n\tfunction setState( s ) {\n\t\trand.state = s;\n\t}\n\n\t/**\n\t* Serializes the pseudorandom number generator as a JSON object.\n\t*\n\t* ## Notes\n\t*\n\t* - `JSON.stringify()` implicitly calls this method when stringifying a PRNG.\n\t*\n\t* @private\n\t* @returns {Object} JSON representation\n\t*/\n\tfunction toJSON() {\n\t\tvar out = {};\n\t\tout.type = 'PRNG';\n\t\tout.name = prng.NAME;\n\t\tout.state = typedarray2json( rand.state );\n\t\tif ( mu === void 0 ) {\n\t\t\tout.params = [];\n\t\t} else {\n\t\t\tout.params = [ mu, b ];\n\t\t}\n\t\treturn out;\n\t}\n\n\t/**\n\t* Returns a pseudorandom number drawn from a Laplace (double exponential) distribution with bound parameters.\n\t*\n\t* @private\n\t* @returns {number} pseudorandom number\n\t*\n\t* @example\n\t* var v = laplace1();\n\t* // returns <number>\n\t*/\n\tfunction laplace1() {\n\t\treturn laplace0( rand, mu, b );\n\t}\n\n\t/**\n\t* Returns a pseudorandom number drawn from a Laplace (double exponential) distribution.\n\t*\n\t* @private\n\t* @param {number} mu - mean\n\t* @param {PositiveNumber} b - scale parameter\n\t* @returns {number} pseudorandom number\n\t*\n\t* @example\n\t* var v = laplace2( 0.0, 2.0 );\n\t* // returns <number>\n\t*\n\t* @example\n\t* var v = laplace2( 0.0, -1.0 );\n\t* // returns NaN\n\t*/\n\tfunction laplace2( mu, b ) {\n\t\tif (\n\t\t\tisnan( mu ) ||\n\t\t\tisnan( b ) ||\n\t\t\tb <= 0.0\n\t\t) {\n\t\t\treturn NaN;\n\t\t}\n\t\treturn laplace0( rand, mu, b );\n\t}\n}\n\n\n// EXPORTS //\n\nmodule.exports = factory;\n", "/**\n* @license Apache-2.0\n*\n* Copyright (c) 2018 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 a pseudorandom number drawn from a Laplace (double exponential) distribution.\n*\n* @name laplace\n* @type {PRNG}\n* @param {number} mu - mean\n* @param {PositiveNumber} b - scale parameter\n* @returns {number} pseudorandom number\n*\n* @example\n* var v = laplace( 0.0, 2.0 );\n* // returns <number>\n*\n* @example\n* var v = laplace( 0.0, -1.0 );\n* // returns NaN\n*/\nvar laplace = factory();\n\n\n// EXPORTS //\n\nmodule.exports = laplace;\n", "/**\n* @license Apache-2.0\n*\n* Copyright (c) 2018 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* Laplace (double exponential) distributed pseudorandom numbers.\n*\n* @module @stdlib/random-base-laplace\n*\n* @example\n* var laplace = require( '@stdlib/random-base-laplace' );\n*\n* var v = laplace( 0.5, 1.0 );\n* // returns <number>\n*\n* @example\n* var factory = require( '@stdlib/random-base-laplace' ).factory;\n* var laplace = factory( 3.0, 2.0, {\n* 'seed': 297\n* });\n*\n* var v = laplace();\n* // returns <number>\n*\n* @example\n* var factory = require( '@stdlib/random-base-laplace' ).factory;\n* var laplace = factory({\n* 'seed': 297\n* });\n*\n* var v = laplace( 3.0, 2.0 );\n* // returns <number>\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"],
5
+ "mappings": "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",
6
+ "names": ["require_validate", "__commonJSMin", "exports", "module", "isNumber", "isPositive", "format", "isnan", "validate", "mu", "b", "require_laplace", "__commonJSMin", "exports", "module", "sign", "abs", "ln", "laplace", "rand", "mu", "b", "u", "require_factory", "__commonJSMin", "exports", "module", "setReadOnly", "setReadOnlyAccessor", "setReadWriteAccessor", "isObject", "isFunction", "hasOwnProp", "constantFunction", "noop", "randu", "isnan", "typedarray2json", "format", "validate", "laplace0", "factory", "opts", "rand", "prng", "err", "mu", "b", "laplace2", "laplace1", "getSeed", "getSeedLength", "getState", "setState", "getStateLength", "getStateSize", "toJSON", "s", "out", "require_main", "__commonJSMin", "exports", "module", "factory", "laplace", "setReadOnly", "main", "factory"]
7
+ }
@@ -16,7 +16,7 @@
16
16
  * limitations under the License.
17
17
  */
18
18
 
19
- // TypeScript Version: 2.0
19
+ // TypeScript Version: 4.1
20
20
 
21
21
  /// <reference types="@stdlib/types"/>
22
22
 
package/lib/factory.js CHANGED
@@ -31,6 +31,7 @@ var noop = require( '@stdlib/utils-noop' );
31
31
  var randu = require( '@stdlib/random-base-mt19937' ).factory;
32
32
  var isnan = require( '@stdlib/math-base-assert-is-nan' );
33
33
  var typedarray2json = require( '@stdlib/array-to-json' );
34
+ var format = require( '@stdlib/string-format' );
34
35
  var validate = require( './validate.js' );
35
36
  var laplace0 = require( './laplace.js' );
36
37
 
@@ -79,11 +80,11 @@ function factory() {
79
80
  } else if ( arguments.length === 1 ) {
80
81
  opts = arguments[ 0 ];
81
82
  if ( !isObject( opts ) ) {
82
- throw new TypeError( 'invalid argument. Options argument must be an object. Value: `' + opts + '`.' );
83
+ throw new TypeError( format( 'invalid argument. Options argument must be an object. Value: `%s`.', opts ) );
83
84
  }
84
85
  if ( hasOwnProp( opts, 'prng' ) ) {
85
86
  if ( !isFunction( opts.prng ) ) {
86
- throw new TypeError( 'invalid option. `prng` option must be a pseudorandom number generator function. Option: `' + opts.prng + '`.' );
87
+ throw new TypeError( format( 'invalid option. `%s` option must be a pseudorandom number generator function. Option: `%s`.', 'prng', opts.prng ) );
87
88
  }
88
89
  rand = opts.prng;
89
90
  } else {
@@ -99,11 +100,11 @@ function factory() {
99
100
  if ( arguments.length > 2 ) {
100
101
  opts = arguments[ 2 ];
101
102
  if ( !isObject( opts ) ) {
102
- throw new TypeError( 'invalid argument. Options argument must be an object. Value: `' + opts + '`.' );
103
+ throw new TypeError( format( 'invalid argument. Options argument must be an object. Value: `%s`.', opts ) );
103
104
  }
104
105
  if ( hasOwnProp( opts, 'prng' ) ) {
105
106
  if ( !isFunction( opts.prng ) ) {
106
- throw new TypeError( 'invalid option. `prng` option must be a pseudorandom number generator function. Option: `' + opts.prng + '`.' );
107
+ throw new TypeError( format( 'invalid option. `%s` option must be a pseudorandom number generator function. Option: `%s`.', 'prng', opts.prng ) );
107
108
  }
108
109
  rand = opts.prng;
109
110
  } else {
package/lib/index.js CHANGED
@@ -51,15 +51,15 @@
51
51
  // MODULES //
52
52
 
53
53
  var setReadOnly = require( '@stdlib/utils-define-nonenumerable-read-only-property' );
54
- var laplace = require( './main.js' );
54
+ var main = require( './main.js' );
55
55
  var factory = require( './factory.js' );
56
56
 
57
57
 
58
58
  // MAIN //
59
59
 
60
- setReadOnly( laplace, 'factory', factory );
60
+ setReadOnly( main, 'factory', factory );
61
61
 
62
62
 
63
63
  // EXPORTS //
64
64
 
65
- module.exports = laplace;
65
+ module.exports = main;
package/lib/validate.js CHANGED
@@ -22,6 +22,7 @@
22
22
 
23
23
  var isNumber = require( '@stdlib/assert-is-number' ).isPrimitive;
24
24
  var isPositive = require( '@stdlib/assert-is-positive-number' ).isPrimitive;
25
+ var format = require( '@stdlib/string-format' );
25
26
  var isnan = require( '@stdlib/assert-is-nan' );
26
27
 
27
28
 
@@ -43,10 +44,10 @@ var isnan = require( '@stdlib/assert-is-nan' );
43
44
  */
44
45
  function validate( mu, b ) {
45
46
  if ( !isNumber( mu ) || isnan( mu ) ) {
46
- return new TypeError( 'invalid argument. `mu` must be a number primitive and not `NaN`. Value: `' + mu + '`.' );
47
+ return new TypeError( format( 'invalid argument. First argument must be a number and not NaN. Value: `%s`.', mu ) );
47
48
  }
48
49
  if ( !isPositive( b ) ) {
49
- return new TypeError( 'invalid argument. `b` must be a positive number. Value: `' + b + '`.' );
50
+ return new TypeError( format( 'invalid argument. Second argument must be a positive number. Value: `%s`.', b ) );
50
51
  }
51
52
  return null;
52
53
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@stdlib/random-base-laplace",
3
- "version": "0.0.6",
3
+ "version": "0.2.0",
4
4
  "description": "Laplace (double exponential) distributed pseudorandom numbers.",
5
5
  "license": "Apache-2.0",
6
6
  "author": {
@@ -37,40 +37,43 @@
37
37
  "url": "https://github.com/stdlib-js/stdlib/issues"
38
38
  },
39
39
  "dependencies": {
40
- "@stdlib/array-to-json": "^0.0.x",
41
- "@stdlib/assert-has-own-property": "^0.0.x",
42
- "@stdlib/assert-is-function": "^0.0.x",
43
- "@stdlib/assert-is-nan": "^0.0.x",
44
- "@stdlib/assert-is-number": "^0.0.x",
45
- "@stdlib/assert-is-plain-object": "^0.0.x",
46
- "@stdlib/assert-is-positive-number": "^0.0.x",
47
- "@stdlib/math-base-assert-is-nan": "^0.0.x",
48
- "@stdlib/math-base-special-abs": "^0.0.x",
49
- "@stdlib/math-base-special-ln": "^0.0.x",
50
- "@stdlib/math-base-special-signum": "^0.0.x",
51
- "@stdlib/random-base-mt19937": "^0.0.x",
52
- "@stdlib/types": "^0.0.x",
53
- "@stdlib/utils-constant-function": "^0.0.x",
54
- "@stdlib/utils-define-nonenumerable-read-only-accessor": "^0.0.x",
55
- "@stdlib/utils-define-nonenumerable-read-only-property": "^0.0.x",
56
- "@stdlib/utils-define-nonenumerable-read-write-accessor": "^0.0.x",
57
- "@stdlib/utils-noop": "^0.0.x"
40
+ "@stdlib/array-to-json": "^0.2.0",
41
+ "@stdlib/assert-has-own-property": "^0.2.0",
42
+ "@stdlib/assert-is-function": "^0.2.0",
43
+ "@stdlib/assert-is-nan": "^0.2.0",
44
+ "@stdlib/assert-is-number": "^0.2.0",
45
+ "@stdlib/assert-is-plain-object": "^0.2.0",
46
+ "@stdlib/assert-is-positive-number": "^0.2.0",
47
+ "@stdlib/math-base-assert-is-nan": "^0.2.0",
48
+ "@stdlib/math-base-special-abs": "^0.2.0",
49
+ "@stdlib/math-base-special-ln": "^0.2.0",
50
+ "@stdlib/math-base-special-signum": "^0.2.0",
51
+ "@stdlib/random-base-mt19937": "^0.2.0",
52
+ "@stdlib/string-format": "^0.2.0",
53
+ "@stdlib/types": "^0.3.1",
54
+ "@stdlib/utils-constant-function": "^0.2.0",
55
+ "@stdlib/utils-define-nonenumerable-read-only-accessor": "^0.2.0",
56
+ "@stdlib/utils-define-nonenumerable-read-only-property": "^0.2.0",
57
+ "@stdlib/utils-define-nonenumerable-read-write-accessor": "^0.2.0",
58
+ "@stdlib/utils-noop": "^0.2.0",
59
+ "@stdlib/error-tools-fmtprodmsg": "^0.2.0"
58
60
  },
59
61
  "devDependencies": {
60
- "@stdlib/array-uint32": "^0.0.x",
61
- "@stdlib/assert-is-uint32array": "^0.0.x",
62
- "@stdlib/bench": "^0.0.x",
63
- "@stdlib/constants-float64-eps": "^0.0.x",
64
- "@stdlib/constants-uint32-max": "^0.0.x",
65
- "@stdlib/process-env": "^0.0.x",
66
- "@stdlib/random-base-minstd": "^0.0.x",
67
- "@stdlib/random-base-minstd-shuffle": "^0.0.x",
68
- "@stdlib/random-base-randu": "^0.0.x",
69
- "@stdlib/stats-kstest": "^0.0.x",
70
- "@stdlib/time-now": "^0.0.x",
62
+ "@stdlib/array-uint32": "^0.2.0",
63
+ "@stdlib/assert-is-uint32array": "^0.2.0",
64
+ "@stdlib/constants-float64-eps": "^0.2.0",
65
+ "@stdlib/constants-uint32-max": "^0.2.0",
66
+ "@stdlib/process-env": "^0.2.0",
67
+ "@stdlib/random-base-minstd": "^0.1.0",
68
+ "@stdlib/random-base-minstd-shuffle": "^0.1.0",
69
+ "@stdlib/random-base-randu": "^0.1.0",
70
+ "@stdlib/stats-kstest": "^0.2.0",
71
+ "@stdlib/time-now": "^0.2.0",
71
72
  "tape": "git+https://github.com/kgryte/tape.git#fix/globby",
72
73
  "istanbul": "^0.4.1",
73
- "tap-spec": "5.x.x"
74
+ "tap-min": "git+https://github.com/Planeshifter/tap-min.git",
75
+ "@stdlib/bench-harness": "^0.2.0",
76
+ "@stdlib/bench": "^0.3.1"
74
77
  },
75
78
  "engines": {
76
79
  "node": ">=0.10.0",
@@ -109,7 +112,7 @@
109
112
  "factory"
110
113
  ],
111
114
  "funding": {
112
- "type": "patreon",
113
- "url": "https://www.patreon.com/athan"
115
+ "type": "opencollective",
116
+ "url": "https://opencollective.com/stdlib"
114
117
  }
115
118
  }
package/docs/repl.txt DELETED
@@ -1,182 +0,0 @@
1
-
2
- {{alias}}( μ, b )
3
- Returns a pseudorandom number drawn from a Laplace distribution.
4
-
5
- If `μ` or `b` is `NaN` or `b <= 0`, the function returns `NaN`.
6
-
7
- Parameters
8
- ----------
9
- μ: number
10
- Mean.
11
-
12
- b: number
13
- Scale parameter.
14
-
15
- Returns
16
- -------
17
- r: number
18
- Pseudorandom number.
19
-
20
- Examples
21
- --------
22
- > var r = {{alias}}( 2.0, 5.0 );
23
-
24
-
25
- {{alias}}.factory( [μ, b, ][options] )
26
- Returns a pseudorandom number generator (PRNG) for generating pseudorandom
27
- numbers drawn from a Laplace distribution.
28
-
29
- If provided `μ` and `b`, the returned PRNG returns random variates drawn
30
- from the specified distribution.
31
-
32
- If not provided `μ` and `b`, the returned PRNG requires that both `μ` and
33
- `b` be provided at each invocation.
34
-
35
- Parameters
36
- ----------
37
- μ: number (optional)
38
- Mean.
39
-
40
- b: number (optional)
41
- Scale parameter.
42
-
43
- options: Object (optional)
44
- Options.
45
-
46
- options.prng: Function (optional)
47
- Pseudorandom number generator (PRNG) for generating uniformly
48
- distributed pseudorandom numbers on the interval `[0,1)`. If provided,
49
- the `state` and `seed` options are ignored. In order to seed the
50
- returned pseudorandom number generator, one must seed the provided
51
- `prng` (assuming the provided `prng` is seedable).
52
-
53
- options.seed: integer|ArrayLikeObject<integer> (optional)
54
- Pseudorandom number generator seed. The seed may be either a positive
55
- unsigned 32-bit integer or, for arbitrary length seeds, an array-like
56
- object containing unsigned 32-bit integers.
57
-
58
- options.state: Uint32Array (optional)
59
- Pseudorandom number generator state. If provided, the `seed` option is
60
- ignored.
61
-
62
- options.copy: boolean (optional)
63
- Boolean indicating whether to copy a provided pseudorandom number
64
- generator state. Setting this option to `false` allows sharing state
65
- between two or more pseudorandom number generators. Setting this option
66
- to `true` ensures that a returned generator has exclusive control over
67
- its internal state. Default: true.
68
-
69
- Returns
70
- -------
71
- rand: Function
72
- Pseudorandom number generator (PRNG).
73
-
74
- Examples
75
- --------
76
- // Basic usage:
77
- > var rand = {{alias}}.factory();
78
- > var r = rand( 0.1, 1.5 );
79
- > r = rand( 2.0, 3.14 );
80
-
81
- // Provide `μ` and `b`:
82
- > rand = {{alias}}.factory( 0.1, 1.5 );
83
- > r = rand();
84
- > r = rand();
85
-
86
-
87
- {{alias}}.NAME
88
- Generator name.
89
-
90
- Examples
91
- --------
92
- > var str = {{alias}}.NAME
93
- 'laplace'
94
-
95
-
96
- {{alias}}.PRNG
97
- Underlying pseudorandom number generator.
98
-
99
- Examples
100
- --------
101
- > var prng = {{alias}}.PRNG;
102
-
103
-
104
- {{alias}}.seed
105
- Pseudorandom number generator seed.
106
-
107
- Examples
108
- --------
109
- > var seed = {{alias}}.seed;
110
-
111
-
112
- {{alias}}.seedLength
113
- Length of generator seed.
114
-
115
- Examples
116
- --------
117
- > var len = {{alias}}.seedLength;
118
-
119
-
120
- {{alias}}.state
121
- Generator state.
122
-
123
- Examples
124
- --------
125
- > var r = {{alias}}( 2.0, 5.0 )
126
- <number>
127
- > r = {{alias}}( 2.0, 5.0 )
128
- <number>
129
- > r = {{alias}}( 2.0, 5.0 )
130
- <number>
131
-
132
- // Get a copy of the current state:
133
- > var state = {{alias}}.state
134
- <Uint32Array>
135
-
136
- > r = {{alias}}( 2.0, 5.0 )
137
- <number>
138
- > r = {{alias}}( 2.0, 5.0 )
139
- <number>
140
-
141
- // Set the state:
142
- > {{alias}}.state = state;
143
-
144
- // Replay the last two pseudorandom numbers:
145
- > r = {{alias}}( 2.0, 5.0 )
146
- <number>
147
- > r = {{alias}}( 2.0, 5.0 )
148
- <number>
149
-
150
-
151
- {{alias}}.stateLength
152
- Length of generator state.
153
-
154
- Examples
155
- --------
156
- > var len = {{alias}}.stateLength;
157
-
158
-
159
- {{alias}}.byteLength
160
- Size (in bytes) of generator state.
161
-
162
- Examples
163
- --------
164
- > var sz = {{alias}}.byteLength;
165
-
166
-
167
- {{alias}}.toJSON()
168
- Serializes the pseudorandom number generator as a JSON object.
169
-
170
- Returns
171
- -------
172
- out: Object
173
- JSON representation.
174
-
175
- Examples
176
- --------
177
- > var o = {{alias}}.toJSON()
178
- { 'type': 'PRNG', 'name': '...', 'state': {...}, 'params': [] }
179
-
180
- See Also
181
- --------
182
-
@@ -1,220 +0,0 @@
1
- /*
2
- * @license Apache-2.0
3
- *
4
- * Copyright (c) 2019 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
- import laplace = require( './index' );
20
-
21
-
22
- // TESTS //
23
-
24
- // The function returns a number...
25
- {
26
- laplace( 2, 3 ); // $ExpectType number
27
- laplace( -1, 2 ); // $ExpectType number
28
- }
29
-
30
- // The compiler throws an error if the function is provided values other than two numbers...
31
- {
32
- laplace( true, 3 ); // $ExpectError
33
- laplace( false, 2 ); // $ExpectError
34
- laplace( '5', 1 ); // $ExpectError
35
- laplace( [], 1 ); // $ExpectError
36
- laplace( {}, 2 ); // $ExpectError
37
- laplace( ( x: number ): number => x, 2 ); // $ExpectError
38
-
39
- laplace( 9, true ); // $ExpectError
40
- laplace( 9, false ); // $ExpectError
41
- laplace( 5, '5' ); // $ExpectError
42
- laplace( 8, [] ); // $ExpectError
43
- laplace( 9, {} ); // $ExpectError
44
- laplace( 8, ( x: number ): number => x ); // $ExpectError
45
- }
46
-
47
- // The compiler throws an error if the function is provided an unsupported number of arguments...
48
- {
49
- laplace(); // $ExpectError
50
- laplace( 2 ); // $ExpectError
51
- laplace( -2, 2, 4 ); // $ExpectError
52
- }
53
-
54
- // Attached to main export is a `factory` method which returns a function...
55
- {
56
- laplace.factory( -2, 2 ); // $ExpectType NullaryFunction
57
- laplace.factory(); // $ExpectType BinaryFunction
58
- laplace.factory( { 'copy': false } ); // $ExpectType BinaryFunction
59
- }
60
-
61
- // The `factory` method returns a function which returns a number...
62
- {
63
- const fcn1 = laplace.factory( -2, 2 );
64
- fcn1(); // $ExpectType number
65
-
66
- const fcn2 = laplace.factory();
67
- fcn2( -2, 2 ); // $ExpectType number
68
- }
69
-
70
- // The compiler throws an error if the function returned by the `factory` method is provided invalid arguments...
71
- {
72
- const fcn1 = laplace.factory( 2, 4 );
73
- fcn1( 12 ); // $ExpectError
74
- fcn1( true ); // $ExpectError
75
- fcn1( false ); // $ExpectError
76
- fcn1( '5' ); // $ExpectError
77
- fcn1( [] ); // $ExpectError
78
- fcn1( {} ); // $ExpectError
79
- fcn1( ( x: number ): number => x ); // $ExpectError
80
-
81
- const fcn2 = laplace.factory();
82
- fcn2( true, 2 ); // $ExpectError
83
- fcn2( false, 2 ); // $ExpectError
84
- fcn2( '5', 2 ); // $ExpectError
85
- fcn2( [], 2 ); // $ExpectError
86
- fcn2( {}, 2 ); // $ExpectError
87
- fcn2( ( x: number ): number => x, 2 ); // $ExpectError
88
-
89
- fcn2( 1, true ); // $ExpectError
90
- fcn2( 1, false ); // $ExpectError
91
- fcn2( 1, '5' ); // $ExpectError
92
- fcn2( 1, [] ); // $ExpectError
93
- fcn2( 1, {} ); // $ExpectError
94
- fcn2( 1, ( x: number ): number => x ); // $ExpectError
95
- }
96
-
97
- // The compiler throws an error if the function returned by the `factory` method is provided an unsupported number of arguments...
98
- {
99
- const fcn1 = laplace.factory( -2, 2 );
100
- fcn1( 1 ); // $ExpectError
101
- fcn1( 2, 1 ); // $ExpectError
102
- fcn1( 2, 1, 1 ); // $ExpectError
103
-
104
- const fcn2 = laplace.factory();
105
- fcn2(); // $ExpectError
106
- fcn2( 1 ); // $ExpectError
107
- fcn2( 2, 1, 1 ); // $ExpectError
108
- }
109
-
110
- // The compiler throws an error if the `factory` method is provided values other than two numbers aside from an options object...
111
- {
112
- laplace.factory( true, 3 ); // $ExpectError
113
- laplace.factory( false, 2 ); // $ExpectError
114
- laplace.factory( '5', 1 ); // $ExpectError
115
- laplace.factory( [], 1 ); // $ExpectError
116
- laplace.factory( {}, 2 ); // $ExpectError
117
- laplace.factory( ( x: number ): number => x, 2 ); // $ExpectError
118
-
119
- laplace.factory( 9, true ); // $ExpectError
120
- laplace.factory( 9, false ); // $ExpectError
121
- laplace.factory( 5, '5' ); // $ExpectError
122
- laplace.factory( 8, [] ); // $ExpectError
123
- laplace.factory( 9, {} ); // $ExpectError
124
- laplace.factory( 8, ( x: number ): number => x ); // $ExpectError
125
-
126
- laplace.factory( true, 3, {} ); // $ExpectError
127
- laplace.factory( false, 2, {} ); // $ExpectError
128
- laplace.factory( '5', 1, {} ); // $ExpectError
129
- laplace.factory( [], 1, {} ); // $ExpectError
130
- laplace.factory( {}, 2, {} ); // $ExpectError
131
- laplace.factory( ( x: number ): number => x, 2, {} ); // $ExpectError
132
-
133
- laplace.factory( 9, true, {} ); // $ExpectError
134
- laplace.factory( 9, false, {} ); // $ExpectError
135
- laplace.factory( 5, '5', {} ); // $ExpectError
136
- laplace.factory( 8, [], {} ); // $ExpectError
137
- laplace.factory( 9, {}, {} ); // $ExpectError
138
- laplace.factory( 8, ( x: number ): number => x, {} ); // $ExpectError
139
- }
140
-
141
- // The compiler throws an error if the `factory` method is provided an options argument which is not an object...
142
- {
143
- laplace.factory( null ); // $ExpectError
144
- laplace.factory( -2, 2, null ); // $ExpectError
145
- }
146
-
147
- // The compiler throws an error if the `factory` method is provided a `prng` option which is not a pseudorandom number generator...
148
- {
149
- laplace.factory( -2, 2, { 'prng': 123 } ); // $ExpectError
150
- laplace.factory( -2, 2, { 'prng': 'abc' } ); // $ExpectError
151
- laplace.factory( -2, 2, { 'prng': null } ); // $ExpectError
152
- laplace.factory( -2, 2, { 'prng': [] } ); // $ExpectError
153
- laplace.factory( -2, 2, { 'prng': {} } ); // $ExpectError
154
- laplace.factory( -2, 2, { 'prng': true ); // $ExpectError
155
-
156
- laplace.factory( { 'prng': 123 } ); // $ExpectError
157
- laplace.factory( { 'prng': 'abc' } ); // $ExpectError
158
- laplace.factory( { 'prng': null } ); // $ExpectError
159
- laplace.factory( { 'prng': [] } ); // $ExpectError
160
- laplace.factory( { 'prng': {} } ); // $ExpectError
161
- laplace.factory( { 'prng': true ); // $ExpectError
162
- }
163
-
164
- // The compiler throws an error if the `factory` method is provided a `seed` option which is not a valid seed...
165
- {
166
- laplace.factory( -2, 2, { 'seed': true } ); // $ExpectError
167
- laplace.factory( -2, 2, { 'seed': 'abc' } ); // $ExpectError
168
- laplace.factory( -2, 2, { 'seed': null } ); // $ExpectError
169
- laplace.factory( -2, 2, { 'seed': [ 'a' ] } ); // $ExpectError
170
- laplace.factory( -2, 2, { 'seed': {} } ); // $ExpectError
171
- laplace.factory( -2, 2, { 'seed': ( x: number ): number => x } ); // $ExpectError
172
-
173
- laplace.factory( { 'seed': true } ); // $ExpectError
174
- laplace.factory( { 'seed': 'abc' } ); // $ExpectError
175
- laplace.factory( { 'seed': null } ); // $ExpectError
176
- laplace.factory( { 'seed': [ 'a' ] } ); // $ExpectError
177
- laplace.factory( { 'seed': {} } ); // $ExpectError
178
- laplace.factory( { 'seed': ( x: number ): number => x } ); // $ExpectError
179
- }
180
-
181
- // The compiler throws an error if the `factory` method is provided a `state` option which is not a valid state...
182
- {
183
- laplace.factory( -2, 2, { 'state': 123 } ); // $ExpectError
184
- laplace.factory( -2, 2, { 'state': 'abc' } ); // $ExpectError
185
- laplace.factory( -2, 2, { 'state': null } ); // $ExpectError
186
- laplace.factory( -2, 2, { 'state': [] } ); // $ExpectError
187
- laplace.factory( -2, 2, { 'state': {} } ); // $ExpectError
188
- laplace.factory( -2, 2, { 'state': true ); // $ExpectError
189
- laplace.factory( -2, 2, { 'state': ( x: number ): number => x } ); // $ExpectError
190
-
191
- laplace.factory( { 'state': 123 } ); // $ExpectError
192
- laplace.factory( { 'state': 'abc' } ); // $ExpectError
193
- laplace.factory( { 'state': null } ); // $ExpectError
194
- laplace.factory( { 'state': [] } ); // $ExpectError
195
- laplace.factory( { 'state': {} } ); // $ExpectError
196
- laplace.factory( { 'state': true ); // $ExpectError
197
- laplace.factory( { 'state': ( x: number ): number => x } ); // $ExpectError
198
- }
199
-
200
- // The compiler throws an error if the `factory` method is provided a `copy` option which is not a boolean...
201
- {
202
- laplace.factory( -2, 2, { 'copy': 123 } ); // $ExpectError
203
- laplace.factory( -2, 2, { 'copy': 'abc' } ); // $ExpectError
204
- laplace.factory( -2, 2, { 'copy': null } ); // $ExpectError
205
- laplace.factory( -2, 2, { 'copy': [] } ); // $ExpectError
206
- laplace.factory( -2, 2, { 'copy': {} } ); // $ExpectError
207
- laplace.factory( -2, 2, { 'copy': ( x: number ): number => x } ); // $ExpectError
208
-
209
- laplace.factory( { 'copy': 123 } ); // $ExpectError
210
- laplace.factory( { 'copy': 'abc' } ); // $ExpectError
211
- laplace.factory( { 'copy': null } ); // $ExpectError
212
- laplace.factory( { 'copy': [] } ); // $ExpectError
213
- laplace.factory( { 'copy': {} } ); // $ExpectError
214
- laplace.factory( { 'copy': ( x: number ): number => x } ); // $ExpectError
215
- }
216
-
217
- // The compiler throws an error if the `factory` method is provided more than three arguments...
218
- {
219
- laplace.factory( 2, 4, {}, 2 ); // $ExpectError
220
- }