oa::data::random_split

Randomly split indices into train, validation, and test subsets. Matches donor FnDataset::randomSplit: clamp train to [0, 1] and validation to [0, 1 - train], truncate their FP32 counts, and assign the remainder to test. The donor header’s claim that the remainder goes to train contradicts its implementation; this port follows the implementation. Errors Returns an error for a negative size, non-finite ratios, allocation failure, or failure to derive a clock seed when seed is zero.

FnRust public API

Function Documentation

pub fn random_split( total_size: i64, train_ratio: f32, val_ratio: f32, seed: u64 ) -> Result<SplitResult>
Randomly split indices into train, validation, and test subsets. Matches donor FnDataset::randomSplit: clamp train to [0, 1] and validation to [0, 1 - train], truncate their FP32 counts, and assign the remainder to test. The donor header’s claim that the remainder goes to train contradicts its implementation; this port follows the implementation. Errors Returns an error for a negative size, non-finite ratios, allocation failure, or failure to derive a clock seed when seed is zero.