[Sidefx-houdini-list] rand() function in HDK

Pablo Giménez pablogipi at gmail.com
Thu Jun 5 14:19:38 EDT 2014


Thanks guys!
At the moment I am just doing what Stephen suggested, I didn't realise that
SYSfastRandom() is passing the seed as a reference for a reason ;)
Cheers


2014-06-05 17:08 GMT+01:00 Olex P <hoknamahn at gmail.com>:

> Hi Pablo,
>
> I would recommend to use Mersenne Twister from boost as it is pretty fast
> and in the same time gives a good long sequence
>
> http://www.cplusplus.com/forum/beginner/78444/
>
>
> On Thu, Jun 5, 2014 at 4:50 PM, Stephen Gustafson <sgustafso at gmail.com>
> wrote:
>
> > SYSfastRandom called twice returns different values because it is
> > modifying the seed value you pass in. To get the same value twice, reset
> > the seed value after each call (or just use a temp var to hold the seed
> you
> > pass in).
> >
> > On June 5, 2014 7:55:27 AM PDT, "Pablo Giménez" <pablogipi at gmail.com>
> > wrote:
> > >Hello.
> > >I am looking for the equivalent of the rand(value) expression in HDK,
> > >basically to get a persistent random value based on a parameter.
> > >So something like rand($ID) .
> > >I have seen that more or less all random stuff in the HDK is based on
> > >SYSfastRandom(seed) and similar functions.
> > >Problem with that function is if I call it twice with the same seed it
> > >returns different values, so it is the usual random generator.
> > >I need something that has a seed and creates a persistent sequence of
> > >random values, so every time I use it with the id attribute to get
> > >random
> > >numbers it returns the same values.
> > >Anybody knows how to do this in the HDK?
> > >
> > >Thanks
> > >
> > >
> > >--
> > >Un saludo
> > >Best Regards
> > >Pablo Giménez
> > >_______________________________________________
> > >Sidefx-houdini-list mailing list
> > >Sidefx-houdini-list at sidefx.com
> > >https://lists.sidefx.com:443/mailman/listinfo/sidefx-houdini-list
> > _______________________________________________
> > Sidefx-houdini-list mailing list
> > Sidefx-houdini-list at sidefx.com
> > https://lists.sidefx.com:443/mailman/listinfo/sidefx-houdini-list
> >
> _______________________________________________
> Sidefx-houdini-list mailing list
> Sidefx-houdini-list at sidefx.com
> https://lists.sidefx.com:443/mailman/listinfo/sidefx-houdini-list
>



-- 
Un saludo
Best Regards
Pablo Giménez



More information about the Sidefx-houdini-list mailing list