[Sidefx-houdini-list] Rand() glitch

brian goodwin brian.r.goodwin at gmail.com
Wed Oct 10 16:55:50 EDT 2007


hey all

I like to use opname in my rops
esspecially used with global variables
ie
project/`$SHOT`/`opname(".")`_`$VER`_$F4.exr
very handy in otls

:)




On 10/10/07, Jordi Bares <jordibares at the-mill.com> wrote:
>
> I does make sense.
>
> The problem though is proximity of the random generated numbers, not the
> actual mechanism so I would still keep the suggestion of wrapping the rand
> function so we get a new one.
>
> I guess I can do that myself via the 123.hip/456.hip, isn't it?
>
> Thanks
> Jb
>
> On 9/10/07 22:07, "Mark Elendt" <mark at sidefx.com> wrote:
>
> > On Tuesday Oct 09 at 21:23, Jordi Bares wrote:
> >> Thanks all for the comment, I though I was mad.
> >>
> >> BTW, this is something SideFX could wrap as a different function, don't
> you
> >> think?
> >>
> >> Like pirand()
> >
> > The issue is that you want to be able to generate the same random
> > numbers (when you play your animation again, you want it to be the
> > same).
> >
> > So, rand(seed) needs to return the same value, for the same seed.
> >
> > Consider two expressions: rand($F) and rand($F+1)
> > For frame 1, you have: rand(1) and rand(2)
> >
> > But then, for frame 2, you have: rand(2) and rand(3)
> >
> > This means that the first expression will give you the same random
> > number that you had in the second expression the previous frame.
> >
> > Even if you did: rand($PT + $F*$PI) and rand($PT + $F*$PI + 1), you'd
> > still end up with the same problem.
> >
> > Point 1/Frame 1:  rand(4.141596), rand(5.141596)
> > Point 2/Frame 1:  rand(5.141596), rand(6.141596)
> >
> > So, again, the first expression will be giving you the same random
> > number you had the previous frame for the second expression.
> >
> > I hope this makes sense...
> >
> > Personally, when I need a random expression, I end up typing some
> > random digits after the decimal:
> >     rand($PT + .319591)
> >     rand($PT + .9381)
> >
> > The only way to "fix" this, would be to have a unique ID for each
> > parameter which would be re-generated identically each time you loaded
> > the .hip file.  We don't have this right now.
> >
> > Of course, if you wanted something that wouldn't be the same every
> > time you evaluated it, then, that's a whole different issue and is
> > relatively easy to solve.
> >
> > I hope this makes sense.
> >
> >> On 9/10/07 16:00, "jlait at sidefx.com" <jlait at sidefx.com> wrote:
> >>
> >>> On Tue, Oct 09, 2007 at 03:06:30PM +0100, Jordi Bares wrote:
> >>>> Hi, I am using rand() function to select randomly textures and I feed
> a
> >>>> different value every time (incremented by 1) and I see the rand()
> function
> >>>> is generating the same exact set of numbers shifted by one.
> >>>>
> >>>> At the moment my solution is to feed the number^2 so I shift more
> than 1
> >>>> pictures and avoid the repetition but it is very ugly.
> >>>>
> >>>> My question is... What is the best way to generate pseudo-random
> numbers
> >>>> based on integers?
> >>>
> >>>     rand($PT + $F*$PI)
> >>>
> >>>     I also recommend $E as a multiplier.
> >
> > _______________________________________________
> > 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
>



-- 
brian



More information about the Sidefx-houdini-list mailing list