This is documentation for Mathematica 6, which was
based on an earlier version of the Wolfram Language.
View current documentation (Version 11.1)

BlockRandom

BlockRandom[expr]
evaluates expr with all pseudorandom generators localized, so that uses of SeedRandom, RandomInteger and related functions within the evaluation of expr do not affect subsequent pseudorandom sequences.
  • BlockRandom[expr] in effect saves the states of all pseudorandom generators before evaluating expr, then restores them afterwards.
  • BlockRandom[expr] always gives the same result as just evaluating expr, though it can affect values obtained for subsequent expressions.
  • Many built-in functions in Mathematica effectively use BlockRandom.
New in 6