make_random_block: Construction of Random Item Blocks

View source: R/make_random_block.R

make_random_blockR Documentation

Construction of Random Item Blocks

Description

Generates a matrix of randomly paired blocks, where each row represents a block of items. This serves as a fast, unstructured initial solution for forced-choice test assembly algorithms.

Usage

make_random_block(total_items, target_items = total_items, block_size)

Arguments

total_items

Integer. The total number of items available in the item pool.

target_items

Integer. The number of items to sample from total_items to build the blocks. Defaults to total_items. Must be \le total_items.

block_size

Integer. The number of items in each block (e.g., 2 for pairs, 3 for triplets). Must be \ge 2.

Details

Given the total number of items in the pool, this function randomly samples target_items and formats them into a block matrix.

If target_items is not a multiple of block_size, the function will randomly draw additional items from the sampled pool to fill the incomplete final block, ensuring the matrix structure is strictly maintained.

Value

A matrix of integers indicating the item IDs. The number of rows equals ceiling(target_items / block_size), and the number of columns equals block_size.

Examples

# Use all 60 items to build 20 blocks of 3
make_random_block(total_items = 60, block_size = 3)

# Sample 45 items from a pool of 60 to build 15 blocks of 3
make_random_block(total_items = 60, target_items = 45, block_size = 3)

# Handle cases where target_items is not a multiple of block_size
# (Will randomly reuse 1 item to fill the last triplet)
make_random_block(total_items = 60, target_items = 50, block_size = 3)


autoFC documentation built on July 14, 2026, 5:07 p.m.