Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

FS-1135 implementation - random functions for collections #17277

Merged
merged 29 commits into from
Jun 26, 2024
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
Show all changes
29 commits
Select commit Hold shift + click to select a range
eb0cbb1
Random functions: old version rebased
Lanayx May 29, 2024
a7986bd
Random functions: Rename functions according to the RFC
Lanayx May 30, 2024
ac6d5aa
Random functions: More naming refactoring and documentation
Lanayx May 30, 2024
aebc5e6
Random functions: More documentation coments
Lanayx May 31, 2024
2f27590
Random functions: Added randomShuffleInPlace functions and docs
Lanayx May 31, 2024
938646a
Random functions: refactoring
Lanayx May 31, 2024
cae6305
Added null checks
Lanayx Jun 1, 2024
3889a45
Added *by functions
Lanayx Jun 2, 2024
73884e5
Random functions: Array random functions tests
Lanayx Jun 3, 2024
6544ca4
Added tests for lists and seqs
Lanayx Jun 4, 2024
dfc6692
Random functions: addded *By tests to arrays and sequences
Lanayx Jun 4, 2024
957bcfa
Random functions: addded *By tests to lists
Lanayx Jun 4, 2024
4488f23
Random functions: try fix CI
Lanayx Jun 4, 2024
e6e059a
Merge branch 'dotnet:main' into master
Lanayx Jun 5, 2024
a8b9a7d
Random functions: review fixes
Lanayx Jun 5, 2024
5b4dbe1
Try fix CI
Lanayx Jun 5, 2024
82860d8
Changed thread local implementation to thread static for performance …
Lanayx Jun 8, 2024
3826743
PR review fix
Lanayx Jun 8, 2024
887a32f
PR fix
Lanayx Jun 11, 2024
a9001fe
PR review fix
Lanayx Jun 11, 2024
c5943be
Reverted HashSet constructor improvement since not netstandard2.0 com…
Lanayx Jun 12, 2024
17e0cfb
Fix formatting
Lanayx Jun 12, 2024
757e00c
Merge branch 'main' into master
psfinaki Jun 13, 2024
2334d18
Fixed nan case for randomizer function
Lanayx Jun 13, 2024
ccee921
PR review fixes
Lanayx Jun 19, 2024
c56e5e2
Merge branch 'main' into master
psfinaki Jun 21, 2024
26785f1
Merge branch 'main' into master
psfinaki Jun 25, 2024
f832333
PR review changes
Lanayx Jun 26, 2024
3f35e7a
Fixed input length check logic for sample
Lanayx Jun 26, 2024
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion src/FSharp.Core/array.fs
Original file line number Diff line number Diff line change
Expand Up @@ -2105,7 +2105,7 @@ module Array =
if inputLength = 0 then
invalidArg "source" LanguagePrimitives.ErrorStrings.InputArrayEmptyString

if count >= inputLength then
if count > inputLength then
psfinaki marked this conversation as resolved.
Show resolved Hide resolved
invalidArg "count" (SR.GetString(SR.notEnoughElements))

let result = Microsoft.FSharp.Primitives.Basics.Array.zeroCreateUnchecked count
Expand Down
4 changes: 2 additions & 2 deletions src/FSharp.Core/list.fs
Original file line number Diff line number Diff line change
Expand Up @@ -1083,7 +1083,7 @@ module List =
if inputLength = 0 then
invalidArg "source" LanguagePrimitives.ErrorStrings.InputSequenceEmptyString

if count >= inputLength then
if count > inputLength then
invalidArg "count" (SR.GetString(SR.notEnoughElements))

// algorithm taken from https://github.com/python/cpython/blob/69b3e8ea569faabccd74036e3d0e5ec7c0c62a20/Lib/random.py#L363-L456
Expand Down Expand Up @@ -1123,7 +1123,7 @@ module List =
if inputLength = 0 then
invalidArg "source" LanguagePrimitives.ErrorStrings.InputSequenceEmptyString

if count >= inputLength then
if count > inputLength then
invalidArg "count" (SR.GetString(SR.notEnoughElements))

let setSize =
Expand Down
4 changes: 2 additions & 2 deletions src/FSharp.Core/seq.fs
Original file line number Diff line number Diff line change
Expand Up @@ -2048,7 +2048,7 @@ module Seq =
if inputLength = 0 then
invalidArg "source" LanguagePrimitives.ErrorStrings.InputSequenceEmptyString

if count >= inputLength then
if count > inputLength then
invalidArg "count" (SR.GetString(SR.notEnoughElements))

// algorithm taken from https://github.com/python/cpython/blob/69b3e8ea569faabccd74036e3d0e5ec7c0c62a20/Lib/random.py#L363-L456
Expand Down Expand Up @@ -2089,7 +2089,7 @@ module Seq =
if inputLength = 0 then
invalidArg "source" LanguagePrimitives.ErrorStrings.InputSequenceEmptyString

if count >= inputLength then
if count > inputLength then
invalidArg "count" (SR.GetString(SR.notEnoughElements))

let setSize =
Expand Down
Loading