@cloudglides/nox 1.1.6 → 3.0.0

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.
Files changed (66) hide show
  1. package/README.md +9 -9
  2. package/example/package.json +1 -1
  3. package/example/src/App.css +38 -7
  4. package/example/src/App.jsx +328 -25
  5. package/package.json +7 -6
  6. package/pnpm-workspace.yaml +3 -0
  7. package/src/core.browser.js +37 -4
  8. package/src/core.js +37 -4
  9. package/src/generators/logistic.js +30 -25
  10. package/src/generators/mixer.js +7 -7
  11. package/src/generators/mt19937.js +10 -7
  12. package/src/generators/pcg64.js +23 -12
  13. package/src/generators/splitmix64.js +12 -6
  14. package/src/generators/tent.js +12 -7
  15. package/src/generators/xorshift64.js +6 -3
  16. package/src/index.browser.js +168 -1
  17. package/src/index.d.ts +68 -4
  18. package/src/index.js +169 -1
  19. package/src/rng.browser.js +5 -6
  20. package/src/rng.js +95 -94
  21. package/src/utils/arrays.js +149 -0
  22. package/src/utils/bits.js +146 -21
  23. package/src/utils/categorical.js +68 -31
  24. package/src/utils/clustering.js +143 -0
  25. package/src/utils/combinatorics.js +113 -69
  26. package/src/utils/confidence.js +145 -0
  27. package/src/utils/decomposition.js +204 -0
  28. package/src/utils/diagnostics.js +309 -0
  29. package/src/utils/distributions-advanced.js +122 -0
  30. package/src/utils/distributions-extra.js +102 -11
  31. package/src/utils/distributions-special.js +77 -20
  32. package/src/utils/distributions.js +99 -35
  33. package/src/utils/effects.js +172 -0
  34. package/src/utils/entropy.browser.js +29 -26
  35. package/src/utils/entropy.js +18 -8
  36. package/src/utils/helpers.js +64 -0
  37. package/src/utils/hypothesis.js +167 -0
  38. package/src/utils/integration.js +137 -0
  39. package/src/utils/interpolation.js +221 -0
  40. package/src/utils/logistic.js +91 -0
  41. package/src/utils/matrix.js +242 -0
  42. package/src/utils/noise.js +36 -22
  43. package/src/utils/odesolvers.js +176 -0
  44. package/src/utils/optimization.js +215 -0
  45. package/src/utils/polynomial.js +136 -0
  46. package/src/utils/precomputed.js +166 -0
  47. package/src/utils/probability.js +199 -0
  48. package/src/utils/pvalues.js +142 -0
  49. package/src/utils/regression.js +170 -0
  50. package/src/utils/resampling.js +112 -0
  51. package/src/utils/rootfinding.js +158 -0
  52. package/src/utils/sampling.js +86 -77
  53. package/src/utils/seed.js +10 -4
  54. package/src/utils/seeding.js +24 -12
  55. package/src/utils/sequence.js +116 -32
  56. package/src/utils/state.js +48 -36
  57. package/src/utils/statistics.js +64 -2
  58. package/src/utils/stochastic.js +91 -31
  59. package/src/utils/stratified.js +108 -0
  60. package/src/utils/timeseries.js +166 -0
  61. package/src/utils/transforms.js +146 -0
  62. package/test/comprehensive.js +4 -3
  63. package/test/new-features.js +52 -0
  64. package/IMPROVEMENTS.md +0 -58
  65. package/PERFORMANCE.md +0 -69
  66. package/example/pnpm-lock.yaml +0 -1006
package/PERFORMANCE.md DELETED
@@ -1,69 +0,0 @@
1
- # Performance Benchmarks
2
-
3
- Benchmarks run on Node.js v20.19.6 on modern hardware.
4
-
5
- ## RNG Operations (per second)
6
-
7
- | Operation | Rate |
8
- |-----------|------|
9
- | `nextFloat()` | 2.5M |
10
- | `nextInt(100)` | 2.8M |
11
- | `int(1, 100)` | 1.8M |
12
- | `bool()` | 3.5M |
13
- | `choice()` | 1.5M |
14
-
15
- ## Batch Operations
16
-
17
- | Operation | Rate |
18
- |-----------|------|
19
- | `floats(1000)` | 2.5k/sec |
20
- | `ints(1000, 100)` | 2.2k/sec |
21
- | `bools(1000)` | 2.8k/sec |
22
-
23
- ## Distributions
24
-
25
- | Distribution | Rate |
26
- |--------------|------|
27
- | `normal()` | 1.0M |
28
- | `exponential()` | 1.5M |
29
- | `uniform()` | 3.5M |
30
- | `poisson()` | 0.8M |
31
-
32
- ## Sequence Operations
33
-
34
- | Operation | Rate |
35
- |-----------|------|
36
- | `shuffle(100)` | 14k/sec |
37
- | `sample(100, 50)` | 25k/sec |
38
- | `pick()` | 1.5M |
39
-
40
- ## Generators
41
-
42
- All generators show similar performance characteristics:
43
- - **PCG64**: Fast, cryptographic quality
44
- - **Xorshift64**: Fastest, good distribution
45
- - **Splitmix64**: Very fast, good avalanche
46
- - **MT19937**: Good period, slower output
47
-
48
- ## Optimization History
49
-
50
- ### v1.1.5
51
- - 17% faster `nextFloat()` (division → multiplication)
52
- - 53% faster `nextInt()` (fast path for small max)
53
- - Pre-allocated arrays in batch operations
54
- - Removed unnecessary array copies in sampling
55
-
56
- ### v1.1.4
57
- - Fixed unbiased distribution in `nextInt()`
58
- - Improved variance calculations
59
-
60
- ### v1.1.3
61
- - Browser compatibility fixes
62
-
63
- ## Tips for Best Performance
64
-
65
- 1. **Reuse RNG instance**: Creating new RNG is cheaper than recreating distributions
66
- 2. **Batch operations**: Use `.floats(n)` instead of loop with `.nextFloat()`
67
- 3. **Small ranges**: `nextInt()` fast-paths for `max < 65536`
68
- 4. **Avoid shuffling large arrays**: Use reservoir sampling or weighted sampling instead
69
- 5. **Cache distribution parameters**: Pre-compute lambda, mean, stddev if used repeatedly