@fable-org/fable-library-js 2.0.0-rc.5 → 2.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.
- package/Array.js +101 -1
- package/Async.js +8 -20
- package/CHANGELOG.md +13 -0
- package/Guid.js +26 -8
- package/List.js +40 -1
- package/Seq.js +49 -2
- package/Set.js +91 -63
- package/String.js +12 -0
- package/package.json +1 -1
- package/quotation.js +618 -0
package/Array.js
CHANGED
|
@@ -3,8 +3,9 @@ import { Helpers_allocateArrayFromCons } from "./Native.js";
|
|
|
3
3
|
import { setItem as setItem_1, item as item_2 } from "./Array.js";
|
|
4
4
|
import { value as value_2, map as map_1, defaultArg, some } from "./Option.js";
|
|
5
5
|
import { min as min_1, max as max_1 } from "./Double.js";
|
|
6
|
-
import { SR_indexOutOfBounds } from "./Global.js";
|
|
6
|
+
import { SR_notEnoughElements, SR_inputMustBeNonNegative, SR_inputSequenceEmpty, SR_Arg_ArgumentOutOfRangeException, SR_indexOutOfBounds } from "./Global.js";
|
|
7
7
|
import { Operators_IsNull } from "./FSharp.Core.js";
|
|
8
|
+
import { nonSeeded } from "./Random.js";
|
|
8
9
|
function indexNotFound() {
|
|
9
10
|
throw new Exception("An index satisfying the predicate was not found in the collection.");
|
|
10
11
|
}
|
|
@@ -1173,6 +1174,105 @@ export function insertManyAt(index, ys, xs, cons) {
|
|
|
1173
1174
|
}
|
|
1174
1175
|
return target;
|
|
1175
1176
|
}
|
|
1177
|
+
export function randomShuffleInPlaceBy(randomizer, xs) {
|
|
1178
|
+
const len = xs.length | 0;
|
|
1179
|
+
for (let i = len - 1; i >= 1; i--) {
|
|
1180
|
+
const r = randomizer();
|
|
1181
|
+
if ((r < 0) ? true : (r >= 1)) {
|
|
1182
|
+
throw new Exception((SR_Arg_ArgumentOutOfRangeException + "\\nParameter name: ") + "randomizer");
|
|
1183
|
+
}
|
|
1184
|
+
const j = ~~(r * (i + 1)) | 0;
|
|
1185
|
+
const tmp = item_2(i, xs);
|
|
1186
|
+
setItem_1(xs, i, item_2(j, xs));
|
|
1187
|
+
setItem_1(xs, j, tmp);
|
|
1188
|
+
}
|
|
1189
|
+
}
|
|
1190
|
+
export function randomShuffleInPlaceWith(random, xs) {
|
|
1191
|
+
randomShuffleInPlaceBy(() => random.NextDouble(), xs);
|
|
1192
|
+
}
|
|
1193
|
+
export function randomShuffleInPlace(xs) {
|
|
1194
|
+
randomShuffleInPlaceWith(nonSeeded(), xs);
|
|
1195
|
+
}
|
|
1196
|
+
export function randomShuffleBy(randomizer, xs) {
|
|
1197
|
+
const arr = copy(xs);
|
|
1198
|
+
randomShuffleInPlaceBy(randomizer, arr);
|
|
1199
|
+
return arr;
|
|
1200
|
+
}
|
|
1201
|
+
export function randomShuffleWith(random, xs) {
|
|
1202
|
+
return randomShuffleBy(() => random.NextDouble(), xs);
|
|
1203
|
+
}
|
|
1204
|
+
export function randomShuffle(xs) {
|
|
1205
|
+
return randomShuffleWith(nonSeeded(), xs);
|
|
1206
|
+
}
|
|
1207
|
+
export function randomChoiceBy(randomizer, xs) {
|
|
1208
|
+
if (isEmpty(xs)) {
|
|
1209
|
+
throw new Exception((SR_inputSequenceEmpty + "\\nParameter name: ") + "source");
|
|
1210
|
+
}
|
|
1211
|
+
const len = xs.length | 0;
|
|
1212
|
+
const r = randomizer();
|
|
1213
|
+
if ((r < 0) ? true : (r >= 1)) {
|
|
1214
|
+
throw new Exception((SR_Arg_ArgumentOutOfRangeException + "\\nParameter name: ") + "randomizer");
|
|
1215
|
+
}
|
|
1216
|
+
return item_2(~~(r * len), xs);
|
|
1217
|
+
}
|
|
1218
|
+
export function randomChoiceWith(random, xs) {
|
|
1219
|
+
return randomChoiceBy(() => random.NextDouble(), xs);
|
|
1220
|
+
}
|
|
1221
|
+
export function randomChoice(xs) {
|
|
1222
|
+
return randomChoiceWith(nonSeeded(), xs);
|
|
1223
|
+
}
|
|
1224
|
+
export function randomChoicesBy(randomizer, count, xs, cons) {
|
|
1225
|
+
if (count < 0) {
|
|
1226
|
+
throw new Exception((SR_inputMustBeNonNegative + "\\nParameter name: ") + "count");
|
|
1227
|
+
}
|
|
1228
|
+
if ((count > 0) && isEmpty(xs)) {
|
|
1229
|
+
throw new Exception((SR_inputSequenceEmpty + "\\nParameter name: ") + "source");
|
|
1230
|
+
}
|
|
1231
|
+
const len = xs.length | 0;
|
|
1232
|
+
return initialize(count, (_arg) => {
|
|
1233
|
+
const r = randomizer();
|
|
1234
|
+
if ((r < 0) ? true : (r >= 1)) {
|
|
1235
|
+
throw new Exception((SR_Arg_ArgumentOutOfRangeException + "\\nParameter name: ") + "randomizer");
|
|
1236
|
+
}
|
|
1237
|
+
return item_2(~~(r * len), xs);
|
|
1238
|
+
}, cons);
|
|
1239
|
+
}
|
|
1240
|
+
export function randomChoicesWith(random, count, xs, cons) {
|
|
1241
|
+
return randomChoicesBy(() => random.NextDouble(), count, xs, cons);
|
|
1242
|
+
}
|
|
1243
|
+
export function randomChoices(count, xs, cons) {
|
|
1244
|
+
return randomChoicesWith(nonSeeded(), count, xs, cons);
|
|
1245
|
+
}
|
|
1246
|
+
export function randomSampleBy(randomizer, count, xs) {
|
|
1247
|
+
if (count < 0) {
|
|
1248
|
+
throw new Exception((SR_inputMustBeNonNegative + "\\nParameter name: ") + "count");
|
|
1249
|
+
}
|
|
1250
|
+
const arr = copy(xs);
|
|
1251
|
+
const len = arr.length | 0;
|
|
1252
|
+
if ((len === 0) && (count > 0)) {
|
|
1253
|
+
throw new Exception((SR_inputSequenceEmpty + "\\nParameter name: ") + "source");
|
|
1254
|
+
}
|
|
1255
|
+
if (count > len) {
|
|
1256
|
+
throw new Exception((SR_notEnoughElements + "\\nParameter name: ") + "count");
|
|
1257
|
+
}
|
|
1258
|
+
for (let i = 0; i <= (count - 1); i++) {
|
|
1259
|
+
const r = randomizer();
|
|
1260
|
+
if ((r < 0) ? true : (r >= 1)) {
|
|
1261
|
+
throw new Exception((SR_Arg_ArgumentOutOfRangeException + "\\nParameter name: ") + "randomizer");
|
|
1262
|
+
}
|
|
1263
|
+
const j = (i + ~~(r * (len - i))) | 0;
|
|
1264
|
+
const tmp = item_2(i, arr);
|
|
1265
|
+
setItem_1(arr, i, item_2(j, arr));
|
|
1266
|
+
setItem_1(arr, j, tmp);
|
|
1267
|
+
}
|
|
1268
|
+
return getSubArray(arr, 0, count);
|
|
1269
|
+
}
|
|
1270
|
+
export function randomSampleWith(random, count, xs) {
|
|
1271
|
+
return randomSampleBy(() => random.NextDouble(), count, xs);
|
|
1272
|
+
}
|
|
1273
|
+
export function randomSample(count, xs) {
|
|
1274
|
+
return randomSampleWith(nonSeeded(), count, xs);
|
|
1275
|
+
}
|
|
1176
1276
|
export function removeAt(index, xs) {
|
|
1177
1277
|
if ((index < 0) ? true : (index >= xs.length)) {
|
|
1178
1278
|
throw new Exception((SR_indexOutOfBounds + "\\nParameter name: ") + "index");
|
package/Async.js
CHANGED
|
@@ -48,28 +48,19 @@ export function throwIfCancellationRequested(token) {
|
|
|
48
48
|
throw new Exception("Operation is cancelled");
|
|
49
49
|
}
|
|
50
50
|
}
|
|
51
|
-
function throwAfter(millisecondsDueTime) {
|
|
52
|
-
return protectedCont((ctx) => {
|
|
53
|
-
let tokenId;
|
|
54
|
-
const timeoutId = setTimeout(() => {
|
|
55
|
-
ctx.cancelToken.removeListener(tokenId);
|
|
56
|
-
ctx.onError(TimeoutException_$ctor());
|
|
57
|
-
}, millisecondsDueTime);
|
|
58
|
-
tokenId = ctx.cancelToken.addListener(() => {
|
|
59
|
-
clearTimeout(timeoutId);
|
|
60
|
-
ctx.onCancel(new OperationCanceledException());
|
|
61
|
-
});
|
|
62
|
-
});
|
|
63
|
-
}
|
|
64
51
|
export function startChild(computation, ms) {
|
|
52
|
+
const promise = startAsPromise(computation);
|
|
53
|
+
let promiseToRun = promise;
|
|
65
54
|
if (ms) {
|
|
66
|
-
|
|
67
|
-
|
|
55
|
+
// Race the computation against a timeout: whichever settles first wins.
|
|
56
|
+
promiseToRun = new Promise((resolve, reject) => {
|
|
57
|
+
const timeoutId = setTimeout(() => reject(TimeoutException_$ctor()), ms);
|
|
58
|
+
promise.then(value => { clearTimeout(timeoutId); resolve(value); }, error => { clearTimeout(timeoutId); reject(error); });
|
|
59
|
+
});
|
|
68
60
|
}
|
|
69
|
-
const promise = startAsPromise(computation);
|
|
70
61
|
// JS Promises are hot, computation has already started
|
|
71
62
|
// but we delay returning the result
|
|
72
|
-
return protectedCont((ctx) => protectedReturn(awaitPromise(
|
|
63
|
+
return protectedCont((ctx) => protectedReturn(awaitPromise(promiseToRun))(ctx));
|
|
73
64
|
}
|
|
74
65
|
export function awaitPromise(p) {
|
|
75
66
|
return fromContinuations((conts) => p.then(conts[0]).catch((err) => (err instanceof OperationCanceledException
|
|
@@ -99,9 +90,6 @@ export function ignore(computation) {
|
|
|
99
90
|
export function parallel(computations) {
|
|
100
91
|
return delay(() => awaitPromise(Promise.all(Array.from(computations, (w) => startAsPromise(w)))));
|
|
101
92
|
}
|
|
102
|
-
function parallel2(a, b) {
|
|
103
|
-
return delay(() => awaitPromise(Promise.all([startAsPromise(a), startAsPromise(b)])));
|
|
104
|
-
}
|
|
105
93
|
export function sequential(computations) {
|
|
106
94
|
function _sequential(computations) {
|
|
107
95
|
let pr = Promise.resolve([]);
|
package/CHANGELOG.md
CHANGED
|
@@ -7,6 +7,19 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
|
|
|
7
7
|
|
|
8
8
|
## Unreleased
|
|
9
9
|
|
|
10
|
+
## 2.0.0 - 2026-04-21
|
|
11
|
+
|
|
12
|
+
### Fixed
|
|
13
|
+
|
|
14
|
+
* [JS/TS] Fix `ResizeArray` (`System.Collections.Generic.List`) equality to use reference equality instead of structural equality (fixes #3718)
|
|
15
|
+
* [JS/TS] Fix `String.Contains` ignoring `StringComparison` argument (second argument was silently discarded)
|
|
16
|
+
|
|
17
|
+
## 2.0.0-rc.6 - 2026-04-07
|
|
18
|
+
|
|
19
|
+
### Fixed
|
|
20
|
+
|
|
21
|
+
* [JS/TS] Fix `Async.StartChild` with timeout always timing out even when the computation finishes before the deadline (fixes #4481) (by @MangelMaxime)
|
|
22
|
+
|
|
10
23
|
## 2.0.0-rc.5 - 2026-03-31
|
|
11
24
|
|
|
12
25
|
### Fixed
|
package/Guid.js
CHANGED
|
@@ -56,15 +56,33 @@ export function tryParse(str, defValue) {
|
|
|
56
56
|
return false;
|
|
57
57
|
}
|
|
58
58
|
}
|
|
59
|
-
// From https://gist.github.com/LeverOne/1308368
|
|
60
59
|
export function newGuid() {
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
}
|
|
67
|
-
|
|
60
|
+
const bytes = new Uint8Array(16);
|
|
61
|
+
crypto.getRandomValues(bytes);
|
|
62
|
+
bytes[6] = (bytes[6] & 0x0f) | 0x40; // version 4
|
|
63
|
+
bytes[8] = (bytes[8] & 0x3f) | 0x80; // variant 1
|
|
64
|
+
const hex = Array.from(bytes, b => b.toString(16).padStart(2, "0")).join("");
|
|
65
|
+
return `${hex.slice(0, 8)}-${hex.slice(8, 12)}-${hex.slice(12, 16)}-${hex.slice(16, 20)}-${hex.slice(20)}`;
|
|
66
|
+
}
|
|
67
|
+
// RFC 9562 UUID v7
|
|
68
|
+
export function createVersion7(timestamp) {
|
|
69
|
+
const ms = timestamp != null ? timestamp.getTime() : Date.now();
|
|
70
|
+
// 48-bit timestamp as hex
|
|
71
|
+
const msHex = Math.floor(ms).toString(16).padStart(12, "0");
|
|
72
|
+
// random bits
|
|
73
|
+
const bytes = new Uint8Array(10);
|
|
74
|
+
crypto.getRandomValues(bytes);
|
|
75
|
+
const view = new DataView(bytes.buffer);
|
|
76
|
+
const randA = view.getUint16(0) & 0x0fff; // 12 bits
|
|
77
|
+
const randB1 = view.getUint16(2) & 0x3fff; // 14 bits
|
|
78
|
+
const randB2 = view.getUint32(4); // 32 bits
|
|
79
|
+
const randB3 = view.getUint16(8); // 16 bits
|
|
80
|
+
const timeLow = msHex.slice(0, 8);
|
|
81
|
+
const timeMid = msHex.slice(8, 12);
|
|
82
|
+
const ver = (0x7000 | randA).toString(16).padStart(4, "0");
|
|
83
|
+
const variantAndRandB = (0x8000 | randB1).toString(16).padStart(4, "0");
|
|
84
|
+
const node = randB2.toString(16).padStart(8, "0") + randB3.toString(16).padStart(4, "0");
|
|
85
|
+
return `${timeLow}-${timeMid}-${ver}-${variantAndRandB}-${node}`;
|
|
68
86
|
}
|
|
69
87
|
// Maps for number <-> hex string conversion
|
|
70
88
|
let _convertMapsInitialized = false;
|
package/List.js
CHANGED
|
@@ -5,7 +5,8 @@ import { Record } from "./Types.js";
|
|
|
5
5
|
import { class_type, record_type, option_type } from "./Reflection.js";
|
|
6
6
|
import { SR_inputSequenceTooLong, SR_inputSequenceEmpty, SR_inputMustBeNonNegative, SR_notEnoughElements, SR_differentLengths, SR_keyNotFoundAlt, SR_indexOutOfBounds, SR_inputWasEmpty } from "./Global.js";
|
|
7
7
|
import { KeyNotFoundException_$ctor_Z721C83C5 } from "./System.Collections.Generic.js";
|
|
8
|
-
import { transpose as transpose_1, splitInto as splitInto_1, windowed as windowed_1, pairwise as pairwise_1, chunkBySize as chunkBySize_1, map as map_1, permute as permute_1, tryFindIndexBack as tryFindIndexBack_1, tryFindBack as tryFindBack_1, scanBack as scanBack_1, item as item_1, foldBack2 as foldBack2_1, foldBack as foldBack_1, setItem, fill } from "./Array.js";
|
|
8
|
+
import { randomSampleBy as randomSampleBy_1, randomChoicesBy as randomChoicesBy_1, randomChoiceBy as randomChoiceBy_1, randomShuffleInPlaceBy, transpose as transpose_1, splitInto as splitInto_1, windowed as windowed_1, pairwise as pairwise_1, chunkBySize as chunkBySize_1, map as map_1, permute as permute_1, tryFindIndexBack as tryFindIndexBack_1, tryFindBack as tryFindBack_1, scanBack as scanBack_1, item as item_1, foldBack2 as foldBack2_1, foldBack as foldBack_1, setItem, fill } from "./Array.js";
|
|
9
|
+
import { nonSeeded } from "./Random.js";
|
|
9
10
|
export class FSharpList extends Record {
|
|
10
11
|
constructor(head, tail) {
|
|
11
12
|
super();
|
|
@@ -1282,3 +1283,41 @@ export function updateAt(index, y, xs) {
|
|
|
1282
1283
|
}
|
|
1283
1284
|
return ys;
|
|
1284
1285
|
}
|
|
1286
|
+
export function randomShuffleBy(randomizer, xs) {
|
|
1287
|
+
const arr = toArray(xs);
|
|
1288
|
+
randomShuffleInPlaceBy(randomizer, arr);
|
|
1289
|
+
return ofArray(arr);
|
|
1290
|
+
}
|
|
1291
|
+
export function randomShuffleWith(random, xs) {
|
|
1292
|
+
return randomShuffleBy(() => random.NextDouble(), xs);
|
|
1293
|
+
}
|
|
1294
|
+
export function randomShuffle(xs) {
|
|
1295
|
+
return randomShuffleWith(nonSeeded(), xs);
|
|
1296
|
+
}
|
|
1297
|
+
export function randomChoiceBy(randomizer, xs) {
|
|
1298
|
+
return randomChoiceBy_1(randomizer, toArray(xs));
|
|
1299
|
+
}
|
|
1300
|
+
export function randomChoiceWith(random, xs) {
|
|
1301
|
+
return randomChoiceBy(() => random.NextDouble(), xs);
|
|
1302
|
+
}
|
|
1303
|
+
export function randomChoice(xs) {
|
|
1304
|
+
return randomChoiceWith(nonSeeded(), xs);
|
|
1305
|
+
}
|
|
1306
|
+
export function randomChoicesBy(randomizer, count, xs) {
|
|
1307
|
+
return ofArray(randomChoicesBy_1(randomizer, count, toArray(xs)));
|
|
1308
|
+
}
|
|
1309
|
+
export function randomChoicesWith(random, count, xs) {
|
|
1310
|
+
return randomChoicesBy(() => random.NextDouble(), count, xs);
|
|
1311
|
+
}
|
|
1312
|
+
export function randomChoices(count, xs) {
|
|
1313
|
+
return randomChoicesWith(nonSeeded(), count, xs);
|
|
1314
|
+
}
|
|
1315
|
+
export function randomSampleBy(randomizer, count, xs) {
|
|
1316
|
+
return ofArray(randomSampleBy_1(randomizer, count, toArray(xs)));
|
|
1317
|
+
}
|
|
1318
|
+
export function randomSampleWith(random, count, xs) {
|
|
1319
|
+
return randomSampleBy(() => random.NextDouble(), count, xs);
|
|
1320
|
+
}
|
|
1321
|
+
export function randomSample(count, xs) {
|
|
1322
|
+
return randomSampleWith(nonSeeded(), count, xs);
|
|
1323
|
+
}
|
package/Seq.js
CHANGED
|
@@ -5,9 +5,11 @@ import { class_type } from "./Reflection.js";
|
|
|
5
5
|
import { some, value as value_1 } from "./Option.js";
|
|
6
6
|
import { KeyNotFoundException_$ctor_Z721C83C5 } from "./System.Collections.Generic.js";
|
|
7
7
|
import { Operators_Lock, Operators_NullArgCheck } from "./FSharp.Core.js";
|
|
8
|
-
import { chunkBySize as chunkBySize_1, permute as permute_1, transpose as transpose_1, map as map_1, windowed as windowed_1, splitInto as splitInto_1, pairwise as pairwise_1, scanBack as scanBack_1, reverse as reverse_1, mapFoldBack as mapFoldBack_1, mapFold as mapFold_1,
|
|
8
|
+
import { randomSampleBy as randomSampleBy_1, randomChoicesBy as randomChoicesBy_1, randomChoice as randomChoice_1, randomChoiceWith as randomChoiceWith_1, randomChoiceBy as randomChoiceBy_1, randomShuffleInPlaceBy, chunkBySize as chunkBySize_1, permute as permute_1, transpose as transpose_1, map as map_1, windowed as windowed_1, splitInto as splitInto_1, pairwise as pairwise_1, scanBack as scanBack_1, reverse as reverse_1, mapFoldBack as mapFoldBack_1, mapFold as mapFold_1, tryItem as tryItem_1, tryHead as tryHead_1, item as item_1, foldBack as foldBack_1, tryFindIndexBack as tryFindIndexBack_1, tryFindBack as tryFindBack_1, singleton as singleton_1 } from "./Array.js";
|
|
9
9
|
import { length as length_1, tryItem as tryItem_2, isEmpty as isEmpty_1, tryHead as tryHead_2, ofSeq as ofSeq_1, ofArray as ofArray_1, toArray as toArray_1, FSharpList } from "./List.js";
|
|
10
|
+
import { min as min_1 } from "./Double.js";
|
|
10
11
|
import { SR_indexOutOfBounds } from "./Global.js";
|
|
12
|
+
import { nonSeeded } from "./Random.js";
|
|
11
13
|
export const SR_enumerationAlreadyFinished = "Enumeration already finished.";
|
|
12
14
|
export const SR_enumerationNotStarted = "Enumeration has not started. Call MoveNext.";
|
|
13
15
|
export const SR_inputSequenceEmpty = "The input sequence was empty.";
|
|
@@ -655,7 +657,14 @@ export function fold2(folder, state, xs, ys) {
|
|
|
655
657
|
}
|
|
656
658
|
}
|
|
657
659
|
export function foldBack2(folder, xs, ys, state) {
|
|
658
|
-
|
|
660
|
+
const xs_1 = toArray(xs);
|
|
661
|
+
const ys_1 = toArray(ys);
|
|
662
|
+
const len = min_1(xs_1.length, ys_1.length) | 0;
|
|
663
|
+
let acc = state;
|
|
664
|
+
for (let i = len - 1; i >= 0; i--) {
|
|
665
|
+
acc = folder(item_1(i, xs_1), item_1(i, ys_1), acc);
|
|
666
|
+
}
|
|
667
|
+
return acc;
|
|
659
668
|
}
|
|
660
669
|
export function forAll(predicate, xs) {
|
|
661
670
|
return !exists((x) => !predicate(x), xs);
|
|
@@ -1368,3 +1377,41 @@ export function updateAt(index, y, xs) {
|
|
|
1368
1377
|
disposeSafe(e_1);
|
|
1369
1378
|
});
|
|
1370
1379
|
}
|
|
1380
|
+
export function randomShuffleBy(randomizer, xs) {
|
|
1381
|
+
const arr = toArray(xs);
|
|
1382
|
+
randomShuffleInPlaceBy(randomizer, arr);
|
|
1383
|
+
return ofArray(arr);
|
|
1384
|
+
}
|
|
1385
|
+
export function randomShuffleWith(random, xs) {
|
|
1386
|
+
return randomShuffleBy(() => random.NextDouble(), xs);
|
|
1387
|
+
}
|
|
1388
|
+
export function randomShuffle(xs) {
|
|
1389
|
+
return randomShuffleWith(nonSeeded(), xs);
|
|
1390
|
+
}
|
|
1391
|
+
export function randomChoiceBy(randomizer, xs) {
|
|
1392
|
+
return randomChoiceBy_1(randomizer, toArray(xs));
|
|
1393
|
+
}
|
|
1394
|
+
export function randomChoiceWith(random, xs) {
|
|
1395
|
+
return randomChoiceWith_1(random, toArray(xs));
|
|
1396
|
+
}
|
|
1397
|
+
export function randomChoice(xs) {
|
|
1398
|
+
return randomChoice_1(toArray(xs));
|
|
1399
|
+
}
|
|
1400
|
+
export function randomChoicesBy(randomizer, count, xs) {
|
|
1401
|
+
return ofArray(randomChoicesBy_1(randomizer, count, toArray(xs)));
|
|
1402
|
+
}
|
|
1403
|
+
export function randomChoicesWith(random, count, xs) {
|
|
1404
|
+
return randomChoicesBy(() => random.NextDouble(), count, xs);
|
|
1405
|
+
}
|
|
1406
|
+
export function randomChoices(count, xs) {
|
|
1407
|
+
return randomChoicesWith(nonSeeded(), count, xs);
|
|
1408
|
+
}
|
|
1409
|
+
export function randomSampleBy(randomizer, count, xs) {
|
|
1410
|
+
return ofArray(randomSampleBy_1(randomizer, count, toArray(xs)));
|
|
1411
|
+
}
|
|
1412
|
+
export function randomSampleWith(random, count, xs) {
|
|
1413
|
+
return randomSampleBy(() => random.NextDouble(), count, xs);
|
|
1414
|
+
}
|
|
1415
|
+
export function randomSample(count, xs) {
|
|
1416
|
+
return randomSampleWith(nonSeeded(), count, xs);
|
|
1417
|
+
}
|