paulroth3d / jupyter-ijavascript-utils

Utility library for working with iJavaScript - a Jupyter Kernel
1 stars 0 forks source link

Add array shuffle and normal/gaussian distribution random generation #47

Closed paulroth3d closed 1 year ago

paulroth3d commented 1 year ago

Add fisher-Yates / Knuth simple shuffle for arrays

paulroth3d commented 1 year ago

Simple discussion https://stackoverflow.com/a/2450976

paulroth3d commented 1 year ago

merge with #48

for example, shuffling arrays with d3 using shuffle, as it already uses fisher-yates observable notebook

or using various random distributions, like d3 random observable notebook

paulroth3d commented 1 year ago

Include comment on random on how to use the random distributions.

Note that d3.normal distribution - https://github.com/d3/d3-random/blob/main/src/normal.js - uses a modified boxMueller.

Here I think it would be interesting not only to use multiple distributions, but to align them to array indices.

This should be added to the random help page.

paulroth3d commented 1 year ago

After boxMullering this over (ark ark ark) this library is not to replace other standards but to support them

as such, the original simplified version of the boxMullewr will be removed , and we will recommend instead that pople use other libraries that can provide better random values - like d3-random or the many ones found here

instead, what I found is often missing though - picking a value from an array based on one of those distributions instead. updating to that.

paulroth3d commented 1 year ago

see the header in both format and random for examples, now supporting format.mapArrayDomain with an example of d3 normal/gaussian distributions.

resolved in 1.34