withSeed

fun <T> withSeed(seed: Long, block: () -> T): T

Temporarily replaces jMetal's RNG with one seeded by seed for the duration of block, then restores the previous generator.

Intended for short, sequential sections that require a specific seed without affecting the global stream. The previous generator is restored even if block throws.

Return

the result of block

Parameters

seed

temporary seed to use inside block

block

code to execute under the temporary RNG