On Fri, 10 Dec 2004, Martin Peach wrote:
Thomas Grill wrote:
something like GUIDs would be great, but i think they should be somehow readable (not Microsoft-like).
A 32-bit number should be sufficient: 0x00000000 to 0xFFFFFFFF allows for more than 4 billion objects in a patch.
What about a running index per patcher, that is incremented every time an object is created?
Yes, that's faster than generating a random number and then checking for duplicates.
Well, if a hashtable is used for the duplicates, and any fast half-believably-random number generator is used, then this solution is sufficiently fast, even for an underclocked 80286.
The real reason that random numbers may be less appropriate is that it makes a .pd (or .pd-xml) patch look more noisy. Which is not sooo much of an issue either, but still more so than "performance".
_____________________________________________________________________ Mathieu Bouchard -=- Montréal QC Canada -=- http://artengine.ca/matju