Random two-way tables with given row and column totals. Equivalent to R's r2dtable().
Uses Patefield's (1981) algorithm and consumes the same uniforms as R, so after setSeed the tables are R's.
Each table is returned as an array of rows (R returns a list of matrices).
Parameters
n: number
Number of tables (fractions are truncated, as in R).
r: readonlynumber[]
Row totals (non-negative integers, at least two).
c: readonlynumber[]
Column totals (non-negative integers, at least two), with the same sum as r.
Returns number[][][]
An array of n tables, each r.length rows of c.length counts.
Throws
RangeError for invalid arguments or totals that differ, and (when n >= 1) for a grand total above 2^24
(16777216; R allows up to 2147483647), as the table of log factorials has total + 1 entries.
Random two-way tables with given row and column totals. Equivalent to R's
r2dtable().Uses Patefield's (1981) algorithm and consumes the same uniforms as R, so after
setSeedthe tables are R's. Each table is returned as an array of rows (R returns a list of matrices).