README.md (5050B)
1 <!-- 2 3 @license Apache-2.0 4 5 Copyright (c) 2018 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 # Random 22 23 [![NPM version][npm-image]][npm-url] [![Build Status][test-image]][test-url] [![Coverage Status][coverage-image]][coverage-url] [![dependencies][dependencies-image]][dependencies-url] 24 25 > Standard library generic random functions. 26 27 <section class="installation"> 28 29 ## Installation 30 31 ```bash 32 npm install @stdlib/random 33 ``` 34 35 </section> 36 37 <section class="usage"> 38 39 ## Usage 40 41 ```javascript 42 var random = require( '@stdlib/random' ); 43 ``` 44 45 #### random 46 47 Standard library generic random functions. 48 49 ```javascript 50 var rand = random; 51 // returns {...} 52 ``` 53 54 The namespace exports the following functions to sample and shuffle elements from an array: 55 56 <!-- <toc pattern="+(sample|shuffle)"> --> 57 58 <div class="namespace-toc"> 59 60 - <span class="signature">[`sample( x[, options] )`][@stdlib/random/sample]</span><span class="delimiter">: </span><span class="description">sample elements from an array-like object.</span> 61 - <span class="signature">[`shuffle( arr[, options] )`][@stdlib/random/shuffle]</span><span class="delimiter">: </span><span class="description">shuffle elements of an array-like object.</span> 62 63 </div> 64 65 <!-- </toc> --> 66 67 It also contains the following sub-namespaces: 68 69 <!-- <toc pattern="+(base|iter|streams)" > --> 70 71 <div class="namespace-toc"> 72 73 - <span class="signature">[`base`][@stdlib/random/base]</span><span class="delimiter">: </span><span class="description">standard library base pseudorandom number generators (PRNGs).</span> 74 - <span class="signature">[`iterators`][@stdlib/random/iter]</span><span class="delimiter">: </span><span class="description">standard library pseudorandom number generator (PRNG) iterators.</span> 75 - <span class="signature">[`streams`][@stdlib/random/streams]</span><span class="delimiter">: </span><span class="description">standard library pseudorandom number generator (PRNG) streams.</span> 76 77 </div> 78 79 <!-- </toc> --> 80 81 </section> 82 83 <!-- /.usage --> 84 85 <section class="examples"> 86 87 ## Examples 88 89 <!-- TODO: better examples --> 90 91 <!-- eslint no-undef: "error" --> 92 93 ```javascript 94 var objectKeys = require( '@stdlib/utils/keys' ); 95 var ns = require( '@stdlib/random' ); 96 97 console.log( objectKeys( ns ) ); 98 ``` 99 100 </section> 101 102 <!-- /.examples --> 103 104 105 <section class="main-repo" > 106 107 * * * 108 109 ## Notice 110 111 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. 112 113 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]. 114 115 #### Community 116 117 [![Chat][chat-image]][chat-url] 118 119 --- 120 121 ## License 122 123 See [LICENSE][stdlib-license]. 124 125 126 ## Copyright 127 128 Copyright © 2016-2021. The Stdlib [Authors][stdlib-authors]. 129 130 </section> 131 132 <!-- /.stdlib --> 133 134 <!-- Section for all links. Make sure to keep an empty line after the `section` element and another before the `/section` close. --> 135 136 <section class="links"> 137 138 [npm-image]: http://img.shields.io/npm/v/@stdlib/random.svg 139 [npm-url]: https://npmjs.org/package/@stdlib/random 140 141 [test-image]: https://github.com/stdlib-js/random/actions/workflows/test.yml/badge.svg 142 [test-url]: https://github.com/stdlib-js/random/actions/workflows/test.yml 143 144 [coverage-image]: https://img.shields.io/codecov/c/github/stdlib-js/random/main.svg 145 [coverage-url]: https://codecov.io/github/stdlib-js/random?branch=main 146 147 [dependencies-image]: https://img.shields.io/david/stdlib-js/random.svg 148 [dependencies-url]: https://david-dm.org/stdlib-js/random/main 149 150 [chat-image]: https://img.shields.io/gitter/room/stdlib-js/stdlib.svg 151 [chat-url]: https://gitter.im/stdlib-js/stdlib/ 152 153 [stdlib]: https://github.com/stdlib-js/stdlib 154 155 [stdlib-authors]: https://github.com/stdlib-js/stdlib/graphs/contributors 156 157 [stdlib-license]: https://raw.githubusercontent.com/stdlib-js/random/main/LICENSE 158 159 <!-- <toc-links> --> 160 161 [@stdlib/random/base]: https://www.npmjs.com/package/@stdlib/random/tree/main/base 162 163 [@stdlib/random/iter]: https://www.npmjs.com/package/@stdlib/random/tree/main/iter 164 165 [@stdlib/random/streams]: https://www.npmjs.com/package/@stdlib/random/tree/main/streams 166 167 [@stdlib/random/sample]: https://www.npmjs.com/package/@stdlib/random/tree/main/sample 168 169 [@stdlib/random/shuffle]: https://www.npmjs.com/package/@stdlib/random/tree/main/shuffle 170 171 <!-- </toc-links> --> 172 173 </section> 174 175 <!-- /.links -->