These is the documentation for arkfunc.R
. It contains all the details,
arguments, and their expected outputs from all variables which are also
saved in Savedata.RData
.
Syntax
arknights_dist(n)
Description
Returns a table of probabilities, frequencies, and odds of Arknights 6★ Headhunting. Inputs the total number of frequencies to be compared to simulated data. Outputs a data frame.
Arguments
n
- An integer of pull streaks to be calculated.
Column Descriptions
-
pulls
- Refers to the nt**h pull when you obtained a 6★ Operator -
type
- Classifies if the pull is under the pity system or not -
rate
- The 6★ Headhunting rate described in the game -
e.freq
- The expected frequency from the total records collected -
prob
- The probability that you will obtain a 6★ Operator at that particular nt**h pull -
c.prob
- The probability that you will obtain a 6★ Operator at the nt**h pull or earlier -
odds
- The ratio of probability of getting a 6★ Operator to not getting one -
fail.odds
- The reciprocal ofodds
Syntax
mtrng_sim(reps, iteration, master.seed = NULL, seedtype = c("default","rng","time")
sprng_sim(reps, iteration, master.seed = NULL, seedtype = c("default","rng","time")
Description
Both of these functions are similar in nature, but differ in the type of
RNG used. mtrng_sim()
uses Mersenne-Twister RNG which is the default
RNG in R, while sprng_sim()
uses Subtractive PRNG which is a custom
RNG through the function srand()
. Returns a list of three elements.
-
[["results"]]
- A matrix with a size depending onreps
(as rows) anditeration
(as columns). It contains records of pull streaks when it got a 6-star operator. -
[["tally"]]
- A data frame of frequency, probabilities, and their corresponding RNG and seeding type that would be used for plotting. -
[[seed_list]]
- A data frame which contains the seed for each iteration. The values might be reproducible when there is a value passed inmaster.seed
(except whenseedtype = "time"
). Ifseedtype
is “default”, it returns a single element which is themaster.seed
. If no values were passed inmaster.seed
, it returnsNULL
.
Arguments
-
reps
- The number of repetitions (pull streaks) after pulling a 6-star Operator for each iteration (account). -
iteration
- The number of accounts to be simulated. -
master.seed
- An argument similar toset.seed()
, but gets an RNG state for reproducibility. This would result to a determined seed for each iteration, except whenseedtype = "time"
. The default isNULL
where its corresponding RNG will use the last RNG state. -
seedtype
- Choose on either “default”, “rng”, or “time”. This would determine on the procedure on seeding each iteration. In case of no values passed on this argument, the default (fixed seed) shall be done.
srand()
- A function created by SurfChu85 that is based from Rosetta Code website. When a seed number is passed into this function, it returns nothing but creates an RNG state which isTEMP55
as a side effect. When theseed
isNULL
, it returns the next generated number fromTEMP55
. If there’s noTEMP55
, a new one would be created with a seed based fromSys.time()
.
A list of 3 elements: “results”, “tally”, and “seed_list”. The first
two are data frames while “seed_list” is a data frame if seedtype
is
“rng” or “time”. If seedtype
is “default”, it returns a number passed
on master.seed
, otherwise, it returns NULL
.
-
exp1
- Results from Mersenne-Twister RNG with fixed seed. -
exp2
- Results from Mersenne-Twister RNG with RNG seeding. -
exp3
- Results from Mersenne-Twister RNG with time seeding. -
exp4
- Results from Subtractive PRNG with fixed seed. -
exp5
- Results from Subtractive PRNG with RNG seeding. -
exp6
- Results from Subtractive PRNG with time seeding.
These variables are made by ggplot2
library. Import the given library
before running.
-
c.freq.plot
- A plot of cumulative frequencies with theoretical values as points. -
c.prob.plot
- A plot of cumulative probabilities with theoretical values as points. -
freq.plot
- The distribution of frequencies with theoretical values as points. -
prob.plot
- The distribution of probabilities with theoretical values as points.
-
theo_df
- The output variable fromarknights_dist()
-
df_tally
- A large data frame that contains all simulated tallies that are row bind (rbind()
)
TEMP55
- The RNG state for the function srand()
. Behaves similar to
.Random.seed
where it uses this vector to generate a random number for
srand()
. When deleted, it would generate automatically with the seed
based from Sys.time()
. Unless you know what you’re doing, avoid
changing this variable at all costs.