From 1b714f06335c4f67ad30486a4cb5c324c882e286 Mon Sep 17 00:00:00 2001 From: Vyacheslav Matyukhin Date: Tue, 13 Sep 2022 03:55:59 +0400 Subject: [PATCH] fix sampleset -> pointset sorting sideeffects --- .../Distributions/SampleSetDist/SampleSetDist_ToPointSet.res | 1 + 1 file changed, 1 insertion(+) diff --git a/packages/squiggle-lang/src/rescript/Distributions/SampleSetDist/SampleSetDist_ToPointSet.res b/packages/squiggle-lang/src/rescript/Distributions/SampleSetDist/SampleSetDist_ToPointSet.res index ec2bf0d0..2836ca78 100644 --- a/packages/squiggle-lang/src/rescript/Distributions/SampleSetDist/SampleSetDist_ToPointSet.res +++ b/packages/squiggle-lang/src/rescript/Distributions/SampleSetDist/SampleSetDist_ToPointSet.res @@ -62,6 +62,7 @@ let toPointSetDist = ( ~samplingInputs: SamplingInputs.samplingInputs, (), ): Internals.Types.outputs => { + let samples = Js.Array2.copy(samples) Array.fast_sort(compare, samples) let minDiscreteToKeep = MagicNumbers.ToPointSet.minDiscreteToKeep(samples) let (continuousPart, discretePart) = E.A.Floats.Sorted.splitContinuousAndDiscreteForMinWeight(