https://github.com/uid11/distribution-of-random-uniform-sort-function
Distribution generated by a random uniform sort function
https://github.com/uid11/distribution-of-random-uniform-sort-function
Last synced: 5 months ago
JSON representation
Distribution generated by a random uniform sort function
- Host: GitHub
- URL: https://github.com/uid11/distribution-of-random-uniform-sort-function
- Owner: uid11
- License: mit
- Created: 2023-06-03T23:45:49.000Z (about 3 years ago)
- Default Branch: main
- Last Pushed: 2023-06-04T02:47:02.000Z (about 3 years ago)
- Last Synced: 2025-02-23T02:20:01.544Z (over 1 year ago)
- Size: 6.84 KB
- Stars: 0
- Watchers: 1
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# distribution-of-random-uniform-sort-function
[![dependencies: none][dependencies-none-image]][dependencies-none-url]
[![code style: prettier][prettier-image]][prettier-url]
[![Conventional Commits][conventional-commits-image]][conventional-commits-url]
[![License MIT][license-image]][license-url]
https://uid11.github.io/distribution-of-random-uniform-sort-function/
Distribution generated by a random uniform sort function (`Math.random`),
that is, generated in this way:
```js
// [0, 1, 2, ..., 99]
const numbers = Array(100).fill().map((_, i) => i);
const sortFunction = () => (Math.random() > 0.5 ? 1 : -1);
const distribution = [...numbers].sort(sortFunction);
```
## License
[MIT][license-url]
[conventional-commits-image]: https://img.shields.io/badge/Conventional_Commits-1.0.0-yellow.svg "The Conventional Commits specification"
[conventional-commits-url]: https://www.conventionalcommits.org/en/v1.0.0/
[dependencies-none-image]: https://img.shields.io/badge/dependencies-none-success.svg "No dependencies"
[dependencies-none-url]: https://github.com/uid11/distribution-of-random-uniform-sort-function/blob/main/package.json
[license-image]: https://img.shields.io/badge/license-MIT-blue.svg "The MIT License"
[license-url]: LICENSE
[prettier-image]: https://img.shields.io/badge/code_style-prettier-ff69b4.svg "Prettier code formatter"
[prettier-url]: https://prettier.io/