[EMAIL PROTECTED] wrote: > Correct me if I am wrong, but there isn't a way to check > back and verify that there are not duplicates
Sorry, but you're wrong. ;^) The example algorithm I posted absolutely does prevent duplicates. That's why it makes an array to store up all the values it's already generated, to check each number and make sure it doesn't repeat it. If you wanted to do something similar in FusionPro to return a unique value for every record, you would make the array global (in the JavaScript Globals). If you didn't want to check for duplicates, you could just call Math.random, multiply it by a base number, and return it. I have to say, though, that if I was making a job for something like raffle tickets, I would just use the CurrentRecordNumber() function to get the ordinal for each record. Those are guaranteed to be unique within each composition. Back to random numbers, this is a slightly more succinct example, from: http://www.codingforums.com/showpost.php?p=439766&postcount=5 // The following function will return // unique random numbers from 1 to tot. function picks(pick,tot) { var ary = new Array(); for (var i = 0; i < tot; i++) ary[i] = i+1; function randOrd() { return Math.round(Math.random())-0.5; } ary.sort(randOrd); return ary.slice(0, pick); } // example: shuffle a deck of cards return picks(52, 52); You can find more examples with Google, something like: http://www.google.com/search?q=math.random+unique Random number generation is a much-studied area of computer science: http://en.wikipedia.org/wiki/Random_number_generation Dan +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+- FusionPro 5.0 Now Available! Variable text on a curve and soft drop-shadows for variable text LIMITED TIME upgrade offer of $299 per license for current customers: http://fusionpro.printable.com/store/upgrade New licenses available for $599 each at: http://fusionpro.printable.com/store/ All FusionPro 5.0 customers to receive FusionPro 5.1 with Adobe Acrobat 8 and InDesign CS3 support when released for FREE. +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+- -- Users of FusionPro Desktop have unlimited free email support. Contact Printable Support at [EMAIL PROTECTED] -- View FusionPro Knowledge Base, FusionPro Samples at www.printable.com/vdp/desktop.htm -- You are currently subscribed to fusionpro as: [EMAIL PROTECTED] To unsubscribe send a blank email to [EMAIL PROTECTED] -- -- Note: All e-mail sent to or from this address will be received or otherwise recorded by the e-mail recipients of this forum. It is subject to archival, monitoring or review by, and/or disclosure to someone other than the recipient. Our privacy policy is posted on www.printplanet.com --
