@gkucmierz/utils 2.0.5 → 2.0.6

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/main.mjs CHANGED
@@ -92,6 +92,9 @@ import {
92
92
  import {
93
93
  powMod, powModBI
94
94
  } from './src/pow-mod.mjs'
95
+ import {
96
+ randNormal
97
+ } from './src/rand-normal.mjs'
95
98
  import {
96
99
  array2range, range2array
97
100
  } from './src/range-array.mjs'
@@ -136,11 +139,12 @@ export * from './src/particle-swarm.mjs';
136
139
  export * from './src/permutations.mjs';
137
140
  export * from './src/phi.mjs';
138
141
  export * from './src/pow-mod.mjs';
142
+ export * from './src/rand-normal.mjs';
139
143
  export * from './src/range-array.mjs';
140
144
  export * from './src/simulated-annealing.mjs';
141
145
  export * from './src/square-root.mjs';
142
146
  export * from './src/tonelli-shanks.mjs';
143
147
 
144
148
  export default [
145
- SetCnt, Trie, arrayHistogram, fromBase64, fromBase64Url, toBase64, toBase64Url, bijective2num, bijective2numBI, num2bijective, num2bijectiveBI, binarySearchArr, binarySearchGE, binarySearchLE, binarySearchRangeIncl, combinations, combinationsIterator, consumeIteratorNonBlocking, copyCase, egcd, factors, factorsBI, formatBigNumber, formatBigNumberBI, wrapFn, gcd, gcdBI, getType, gpn, gpnBI, bin2gray, gray2bin, Heap, heronsFormula, heronsFormulaBI, lcm, lcmBI, ListNode, axisAngleToMatrix4, crossProduct, dotProduct, getRotationMatrixFromVectors, multiplyMatrix4, normalize, projectToTrackball, matrixAsArray, memoize, mod, modBI, nChooseK, naturalSearch, nelderMead, particleSwarmOptimization, permutations, permutationsIterator, phi, phiBI, powMod, powModBI, array2range, range2array, simulatedAnnealing, squareRoot, squareRootBI, tonelliShanksBI
149
+ SetCnt, Trie, arrayHistogram, fromBase64, fromBase64Url, toBase64, toBase64Url, bijective2num, bijective2numBI, num2bijective, num2bijectiveBI, binarySearchArr, binarySearchGE, binarySearchLE, binarySearchRangeIncl, combinations, combinationsIterator, consumeIteratorNonBlocking, copyCase, egcd, factors, factorsBI, formatBigNumber, formatBigNumberBI, wrapFn, gcd, gcdBI, getType, gpn, gpnBI, bin2gray, gray2bin, Heap, heronsFormula, heronsFormulaBI, lcm, lcmBI, ListNode, axisAngleToMatrix4, crossProduct, dotProduct, getRotationMatrixFromVectors, multiplyMatrix4, normalize, projectToTrackball, matrixAsArray, memoize, mod, modBI, nChooseK, naturalSearch, nelderMead, particleSwarmOptimization, permutations, permutationsIterator, phi, phiBI, powMod, powModBI, randNormal, array2range, range2array, simulatedAnnealing, squareRoot, squareRootBI, tonelliShanksBI
146
150
  ];
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@gkucmierz/utils",
3
- "version": "2.0.5",
3
+ "version": "2.0.6",
4
4
  "type": "module",
5
5
  "description": "Usefull functions for solving programming tasks",
6
6
  "keywords": [
@@ -0,0 +1,5 @@
1
+ export const randNormal = (mean = 0, sigma = 1) => {
2
+ const y1 = Math.random();
3
+ const y2 = Math.random();
4
+ return mean + sigma * Math.cos(2 * Math.PI * y2) * Math.sqrt(-2 * Math.log(y1));
5
+ };