Welcome to the Second Life Forums Archive

These forums are CLOSED. Please visit the new forums HERE

Req : llIntRand() , INVENTORY_ANIMATION constant

Codswallop Cassidy
Registered User
Join date: 30 Dec 2003
Posts: 53
06-27-2004 03:00
1) llIntRand() , at first this probably seems trivial since you can run llFloor or llCeiling or whatever on it to obtain a round integery but this becomes increasingly ineffective on small ranges i.e. say your max is 3, you start getting a lot of repeatted value, depending on your rounding and say I was cycling textures using random as my list index, there'd also be a lot of wasted calls obtaining the same results.

2) INVENTORY_ANIMATION constant. I am requesting this mainly to be used with llGetInventoryName(), so we dont end up having to hardcode things like dance bracelets, users can put any animations they want in there and will be added to the list. The same way any other inventory object works
Grim Lupis
Dark Wolf
Join date: 11 Jul 2003
Posts: 762
Re: Req : llIntRand() , INVENTORY_ANIMATION constant
06-27-2004 07:26
From: someone
Originally posted by Codswallop Cassidy
1) llIntRand() , at first this probably seems trivial since you can run llFloor or llCeiling or whatever on it to obtain a round integery but this becomes increasingly ineffective on small ranges i.e. say your max is 3, you start getting a lot of repeatted value, depending on your rounding and say I was cycling textures using random as my list index, there'd also be a lot of wasted calls obtaining the same results.


CODE

integer nRand(integer max)
{
return llFloor(llFrand(2000000000)) % (max + 1);
}


I do agree, though, that it's a huge waste of nested calls.
_____________________
Grim

"God only made a few perfect heads, the rest of them he put hair on." -- Unknown
Ezhar Fairlight
professional slacker
Join date: 30 Jun 2003
Posts: 310
Re: Req : llIntRand() , INVENTORY_ANIMATION constant
06-27-2004 11:09
From: someone
Originally posted by Codswallop Cassidy
2) INVENTORY_ANIMATION constant


Both INVENTORY_ANIMATION and INVENTORY_GESTURE have been added with 1.4.0 - and they do work.
_____________________
Eggy Lippmann
Wiktator
Join date: 1 May 2003
Posts: 7,939
Re: Req : llIntRand() , INVENTORY_ANIMATION constant
06-27-2004 11:33
From: someone
Originally posted by Codswallop Cassidy
1) llIntRand() , at first this probably seems trivial since you can run llFloor or llCeiling or whatever on it to obtain a round integery but this becomes increasingly ineffective on small ranges i.e. say your max is 3, you start getting a lot of repeatted value, depending on your rounding and say I was cycling textures using random as my list index, there'd also be a lot of wasted calls obtaining the same results.

It's perfectly normal for random numbers to clump a lot. If you want something different every time, cycle through a randomly sorted list of numbers or something.
Bino Arbuckle
Registered User
Join date: 31 Dec 2002
Posts: 369
06-27-2004 20:22
There's also llRound() for those of you having issues with llFloor() and llCeil() for small ranges of numbers.