Skip to content

Commit

Permalink
fix bug in creation of Dutch SSN
Browse files Browse the repository at this point in the history
  • Loading branch information
RMHogervorst committed Apr 25, 2024
1 parent d861ce8 commit 3b81984
Showing 1 changed file with 3 additions and 5 deletions.
8 changes: 3 additions & 5 deletions R/ssn-provider-all.R
Original file line number Diff line number Diff line change
Expand Up @@ -48,11 +48,9 @@ SSNProvider_nl_NL <- R6Class(
#' @description Make a SSN
#' Dutch SSN (BSN) is 9 digits that follow a certain proof (elfproef).
render = function() {
first_8 <- as.integer(strsplit(as.character(as.integer(runif(1) * 1e8)), "")[[1]])
if (length(first_8) == 7) {
first_8[8] <- 1
}
final_number <- checksum_util(first_8,9:2) %% 11
first_8 <- sample(0:9, 8, replace = TRUE)

final_number <- checksum_util(first_8, 9:2) %% 11
bsn <- paste0(c(first_8, final_number), collapse = "")
bsn
}
Expand Down

0 comments on commit 3b81984

Please sign in to comment.