Skip to content

Commit

Permalink
fix mssql sql_runif() to return random number for each row in result set
Browse files Browse the repository at this point in the history
  • Loading branch information
thomashulst committed May 16, 2024
1 parent 8f2fcb0 commit 13b2252
Showing 1 changed file with 2 additions and 1 deletion.
3 changes: 2 additions & 1 deletion R/backend-mssql.R
Original file line number Diff line number Diff line change
Expand Up @@ -294,7 +294,8 @@ simulate_mssql <- function(version = "15.0") {
is.na = mssql_is_null,

runif = function(n = n(), min = 0, max = 1) {
sql_runif(RAND(), n = {{ n }}, min = min, max = max)
# https://stackoverflow.com/a/9039661
sql_runif(RAND(CHECKSUM(NEWID())), n = {{ n }}, min = min, max = max)
},

# string functions ------------------------------------------------
Expand Down

0 comments on commit 13b2252

Please sign in to comment.