[sv-ec] Invalid example of srandom - mantis 1391

From: Ryan, Ray <Ray_Ryan_at_.....>
Date: Tue Mar 21 2006 - 14:16:03 PST
I entered mantis #1391 for the following

In section 13.13.2 the example contains the statement:
process::self.srandom(100);

This is not a valid call to srandom. In this statement, the prefix of
srandom is "process::self". This is a reference to the scope of the self
method - not a call to the self function. The scope of the self method
does NOT include the srandom method.

A correct example should read:
integer x, y, z;
fork //set a seed at the start of a thread
begin 
  process pvar;
  pvar = process::self;
  pvar.srandom(100);
  x = $urandom;
end
//set a seed during a thread
begin 
  process pvar;
  pvar = process::self;
  y = $urandom;
  pvar.srandom(200);
end
// draw 2 values from the thread RNG
begin z = $urandom + $urandom ; end
join


- Ray
Received on Tue Mar 21 14:16:06 2006

This archive was generated by hypermail 2.1.8 : Tue Mar 21 2006 - 14:16:21 PST