Re: Seed in random generation opcodes.

From: John Lazzaro (lazzaro@cs.berkeley.edu)
Date: Mon Apr 10 2000 - 17:03:12 EDT


> and how I can "emulate" the seed arguments.

Actually, if you look at this discussion:

http://sound.media.mit.edu/~eds/mpeg4-old/saol-dev-archive

search for "Is SFront deterministic"

You'll see that sfront is actually "out of spec" at
the moment in this regard -- if I read this discussion
correctly, sfront is supposed to use a unique seed
on each invocation of the sa.c file, so that the
random numbers are different every time. The idea is,
if you want "repeatable" random numbers (i.e. under
the programmers control via a seed) you'll write your
own from scratch in SAOL.

I actually forgot about this sfront non-compliance, I'll
add it to the list of things to do. In the meanwhile,
you can fix it yourself pretty easily:

Goto this file:

sfront/src/lib/csrc/runtime.c
sfront/src/lib/csrc/runtimef.c

You'll see:

main(int argc, char *argv[])

{
  srand(9753193L);

The very first thing that happens in main is
seeding the random number generator with a
constant, and this seed becomes the basis for
all the rand opcodes in SAOL. For it to be in
spec, it should use some ANSI-compatible way
to generate a unique seed that is also a "good"
seed for rand().

Once you've changed both files (one is for fixed-point
output drivers, one is for float)

cd sfront/src/lib/

and type "make". This will create new files
in sfront/src/ that include the changes to
runtime.c and runtimef.c. Then,

cd sfront/src

and type "make". This will create the sfront with
your changes.

                                                --jl



This archive was generated by hypermail 2b29 : Mon Jan 28 2002 - 11:46:38 EST