Setting the random seed

Is there a way to set the random seed in odejava? The way it is done in ODE is through the use of the “void dRandSetSeed(long)” function in misc.cpp. This is useful for exactly recreating simulations without the need to save position and other data at each step (as long as no other randomness is introduced such as user input).

There doesn’t appear to be, although there should be.

How desperatly do you need it?

It can be added to org.odejava.ode.Ode by adding the relevent line in odejava.i (in odejava/combile/odejava), then running swig to regenerate the wrappers (including Ode.java), and recompiling the natives.

I shall add it in next time I update the binaries but I wasn’t planning to for another few months.

Will.

My simulations are required to be repeatable. I had to make all my random numbers come from my own seed but I never had to setup the ode random seed. What functions in ode use the seed? I may need to set this random seed in ODE as well in the future.

not 100% sure, the mailing list will be able to answer though :slight_smile:

I’ll definitally add it in next time I do a build.

Will.

I’ve added this in - all you need to do is add the line “void dRandSetSeed (long seed);” to odejava.i and recompile the natives.

When the cylinder stuff is fixed up I shall release new natives. Any more functions that you need?

Will.

Vikstar have you used the random seed thing yet? I have put it into mine but my simulations are not deterministic after a reset. If I close down java and resart, everything is sweet. But it I run a simulation twice in the same VM, everything does slightly different things. It still looks real, but positions and orientations quickly diverge thanks to bloody chaos thoery.

I haven’t tried it yet, still trying to develop persistance for my framework.

dRandSetSeed is now implemented in Odejava.

Will.

And how do we set it? Thanks in advance.

Ode.dRandSetSeed(long )