
(* generates pseudo random 32 bit unsigned integers (algorithm is linear congruential generator) *)
FUNCTION_BLOCK PseudoRandom
	IF(first_use AND Execute)THEN
		RandomNumber := Seed;
		first_use := FALSE;
	END_IF;

	IF(NOT(previous_execute) AND Execute)THEN
		RandomNumber := (a*RandomNumber + c) MOD m;
	END_IF;

	previous_execute := Execute;
END_FUNCTION_BLOCK
