An open API service indexing awesome lists of open source software.

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

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/