diff --git a/DESCRIPTION b/DESCRIPTION index 8231a73..124dc60 100644 --- a/DESCRIPTION +++ b/DESCRIPTION @@ -1,6 +1,6 @@ Package: shikakusphere Title: Miscellaneous Functions for Japanese Mahjong -Version: 0.1.1 +Version: 0.1.2 Authors@R: c( person("Akiru", "Kato", , "paithiov909@gmail.com", role = c("aut", "cre")), person("tomo", "hxx", role = "ctb", diff --git a/R/rand.R b/R/rand.R index 00d65b6..4ede8ad 100644 --- a/R/rand.R +++ b/R/rand.R @@ -7,7 +7,7 @@ #' @returns A tibble that consists of 4 columns of `paistr` vector. #' @export #' @examples -#' rand_qipai(4) +#' rand_qipai(3) rand_qipai <- function(nrow, rule = default_rule(), seed = sample.int(1e4, 1)) { if (!is_valid_rule(rule)) { rlang::abort("The rule set is invalid.") @@ -32,10 +32,12 @@ rand_qipai <- function(nrow, rule = default_rule(), seed = sample.int(1e4, 1)) { #' @param seed An integer scalar. #' Used for initializing the random number generator. #' @returns -#' A function inheriting class \code{purrr_function_partial} +#' A function inheriting class `purrr_function_compose` #' that takes single arguments `n`: number of hands to be generated. #' @export #' @importFrom purrr partial +#' @examples +#' rand_hands()(3) rand_hands <- function( hupai = c( "pinghe", # defaults to pinghe @@ -314,5 +316,5 @@ rand_hands <- function( ) ) # nolint end - func + purrr::compose(paistr, func) } diff --git a/man/rand_hands.Rd b/man/rand_hands.Rd index 00fcc80..a6bb3c8 100644 --- a/man/rand_hands.Rd +++ b/man/rand_hands.Rd @@ -29,9 +29,12 @@ rand_hands( Used for initializing the random number generator.} } \value{ -A function inheriting class \code{purrr_function_partial} +A function inheriting class \code{purrr_function_compose} that takes single arguments \code{n}: number of hands to be generated. } \description{ Create a function to randomly generate hands } +\examples{ +rand_hands()(3) +} diff --git a/man/rand_qipai.Rd b/man/rand_qipai.Rd index dc1c95e..0ce10c2 100644 --- a/man/rand_qipai.Rd +++ b/man/rand_qipai.Rd @@ -21,5 +21,5 @@ A tibble that consists of 4 columns of \code{paistr} vector. Generate hands at random } \examples{ -rand_qipai(4) +rand_qipai(3) }