11# File src/library/base/R/RNG.R
22# Part of the R package, https://www.R-project.org
33#
4- # Copyright (C) 1995-2019 The R Core Team
4+ # Copyright (C) 1995-2022 The R Core Team
55#
66# This program is free software; you can redistribute it and/or modify
77# it under the terms of the GNU General Public License as published by
@@ -33,7 +33,7 @@ RNGkind <- function(kind = NULL, normal.kind = NULL, sample.kind = NULL)
3333 do.set <- length(kind ) > 0L
3434 if (do.set ) {
3535 if (! is.character(kind ) || length(kind ) > 1L )
36- stop(" 'kind' must be a character string of length 1 (RNG to be used)." )
36+ stop(" 'kind' must be a character string (RNG to be used)." )
3737 if (is.na(i.knd <- pmatch(kind , kinds ) - 1L ))
3838 stop(gettextf(" '%s' is not a valid abbreviation of an RNG" , kind ),
3939 domain = NA )
@@ -42,7 +42,8 @@ RNGkind <- function(kind = NULL, normal.kind = NULL, sample.kind = NULL)
4242
4343 if (! is.null(normal.kind )) {
4444 if (! is.character(normal.kind ) || length(normal.kind ) != 1L )
45- stop(" 'normal.kind' must be a character string of length 1" )
45+ stop(gettextf(" '%s' must be a character string" , " normal.kind" ),
46+ domain = NA )
4647 normal.kind <- pmatch(normal.kind , n.kinds ) - 1L
4748 if (is.na(normal.kind ))
4849 stop(gettextf(" '%s' is not a valid choice" , normal.kind ),
@@ -55,7 +56,8 @@ RNGkind <- function(kind = NULL, normal.kind = NULL, sample.kind = NULL)
5556
5657 if (! is.null(sample.kind )) {
5758 if (! is.character(sample.kind ) || length(sample.kind ) != 1L )
58- stop(" 'sample.kind' must be a character string of length 1" )
59+ stop(gettextf(" '%s' must be a character string" , " sample.kind" ),
60+ domain = NA )
5961 sample.kind <- pmatch(sample.kind , s.kinds ) - 1L
6062 if (is.na(sample.kind ))
6163 stop(gettextf(" '%s' is not a valid choice" , sample.kind ),
@@ -82,7 +84,7 @@ set.seed <- function(seed, kind = NULL, normal.kind = NULL, sample.kind = NULL)
8284 s.kinds <- c(" Rounding" , " Rejection" , " default" )
8385 if (length(kind ) ) {
8486 if (! is.character(kind ) || length(kind ) > 1L )
85- stop(" 'kind' must be a character string of length 1 (RNG to be used)." )
87+ stop(" 'kind' must be a character string (RNG to be used)." )
8688 if (is.na(i.knd <- pmatch(kind , kinds ) - 1L ))
8789 stop(gettextf(" '%s' is not a valid abbreviation of an RNG" , kind ),
8890 domain = NA )
@@ -91,7 +93,8 @@ set.seed <- function(seed, kind = NULL, normal.kind = NULL, sample.kind = NULL)
9193
9294 if (! is.null(normal.kind )) {
9395 if (! is.character(normal.kind ) || length(normal.kind ) != 1L )
94- stop(" 'normal.kind' must be a character string of length 1" )
96+ stop(gettextf(" '%s' must be a character string" , " normal.kind" ),
97+ domain = NA )
9598 normal.kind <- pmatch(normal.kind , n.kinds ) - 1L
9699 if (is.na(normal.kind ))
97100 stop(gettextf(" '%s' is not a valid choice" , normal.kind ),
@@ -103,7 +106,8 @@ set.seed <- function(seed, kind = NULL, normal.kind = NULL, sample.kind = NULL)
103106 }
104107 if (! is.null(sample.kind )) {
105108 if (! is.character(sample.kind ) || length(sample.kind ) != 1L )
106- stop(" 'sample.kind' must be a character string of length 1" )
109+ stop(gettextf(" '%s' must be a character string" , " sample.kind" ),
110+ domain = NA )
107111 sample.kind <- pmatch(sample.kind , s.kinds ) - 1L
108112 if (is.na(sample.kind ))
109113 stop(gettextf(" '%s' is not a valid choice" , sample.kind ),
0 commit comments