Here's a sample output from my script on v6: Timestamp: 1287070640 = Final Code: YYFUVXMI Timestamp: 1287070641 = Final Code: KCVNAZCR Timestamp: 1287070642 = Final Code: LRCBFPAU Timestamp: 1287070643 = Final Code: YYFWJXMI Timestamp: 1287070644 = Final Code: NVPTNVXZ Timestamp: 1287070645 = Final Code: MGIGKFYW Timestamp: 1287070646 = Final Code: NVPSPVXZ Timestamp: 1287070647 = Final Code: LRCDJPAU Timestamp: 1287070648 = Final Code: NVPRWVXZ Timestamp: 1287070649 = Final Code: XKYKEHOF Timestamp: 1287070650 = Final Code: ZNMKTNKL Timestamp: 1287070651 = Final Code: XKYLVHOF Timestamp: 1287070652 = Final Code: KCVSTZCR Timestamp: 1287070653 = Final Code: YYFZSXMI Timestamp: 1287070654 = Final Code: NVPPKVXZ Timestamp: 1287070655 = Final Code: NVPOGVXZ Timestamp: 1287070656 = Final Code: NVPOQVXZ Timestamp: 1287070657 = Final Code: KCVTVACR Timestamp: 1287070658 = Final Code: NVPNCVXZ Timestamp: 1287070659 = Final Code: LRCIUPAU Timestamp: 1287070660 = Final Code: ZNMGLNKL Timestamp: 1287070661 = Final Code: ZNMGANKL Timestamp: 1287070662 = Final Code: MGIZVFYW Timestamp: 1287070663 = Final Code: YYFDSXMI Timestamp: 1287070664 = Final Code: NVPLPVXZ Timestamp: 1287070665 = Final Code: ZNMELNKL Timestamp: 1287070666 = Final Code: MGIYQFYW Timestamp: 1287070667 = Final Code: MGIXWFYW Timestamp: 1287070668 = Final Code: MGIXJFYW Timestamp: 1287070669 = Final Code: MGIXTFYW Timestamp: 1287070670 = Final Code: NVPJLVXZ Timestamp: 1287070671 = Final Code: XKYTPIOF Timestamp: 1287070672 = Final Code: ZNMCENKL Timestamp: 1287070673 = Final Code: LRCNIQAU Timestamp: 1287070674 = Final Code: XKYUTIOF Timestamp: 1287070675 = Final Code: ZNMBFNKL Timestamp: 1287070676 = Final Code: XKYVQIOF Timestamp: 1287070677 = Final Code: MGITWGYW Timestamp: 1287070678 = Final Code: ZNMZMNKL Timestamp: 1287070679 = Final Code: BCSLMDJN Timestamp: 1287070680 = Final Code: BCSLHDJN Timestamp: 1287070681 = Final Code: XKYWMIOF Timestamp: 1287070682 = Final Code: LRCRXQAU Timestamp: 1287070683 = Final Code: LRCRJQAU Timestamp: 1287070684 = Final Code: ZNMXROKL Timestamp: 1287070685 = Final Code: ZNMWHOKL Timestamp: 1287070686 = Final Code: KCVFPACR Timestamp: 1287070687 = Final Code: XKYZRIOF Timestamp: 1287070688 = Final Code: NVPCJVXZ Timestamp: 1287070689 = Final Code: MGIPHGYW Timestamp: 1287070690 = Final Code: ZNMVXOKL Timestamp: 1287070691 = Final Code: LRCUIQAU Timestamp: 1287070692 = Final Code: BCSGRDJN Timestamp: 1287070693 = Final Code: NVPALWXZ Timestamp: 1287070694 = Final Code: LRCVBQAU Timestamp: 1287070695 = Final Code: ZNMTDOKL Timestamp: 1287070696 = Final Code: KCVIUACR Timestamp: 1287070697 = Final Code: MGIMLGYW Timestamp: 1287070698 = Final Code: ZNMRHOKL Timestamp: 1287070699 = Final Code: KCVKQACR Timestamp: 1287070700 = Final Code: ZNMRYOKL Timestamp: 1287070701 = Final Code: MGIKCGYW Timestamp: 1287070702 = Final Code: MGIKHGYW Timestamp: 1287070703 = Final Code: LRCZQQAU Timestamp: 1287070704 = Final Code: YYFTFYMI Timestamp: 1287070705 = Final Code: XKYGUIOF
-----Original Message----- From: Roland Dumas [mailto:[email protected]] Sent: Thursday, October 14, 2010 3:18 PM To: [email protected] Subject: Re: Witango-Talk: generating unique codes I need to stare at this code a bit more. I made it witango 5 compatible (while object and instead of @sleep, I just threw away output based on the same timestamp) results code: NZVWIXXX timestamp: 1287058511 code: LURAVSXX timestamp: 1287058512 code: LURAVSXX timestamp: 1287058513 code: NZVWIXXX timestamp: 1287058514 code: ZLNKFQXX timestamp: 1287058515 code: BNCILFXX timestamp: 1287058516 code: KRCCOCXX timestamp: 1287058517 code: NZVWIXXX timestamp: 1287058518 code: BNCILFXX timestamp: 1287058519 code: BNCILFXX timestamp: 1287058520 code: NZVWIYXX timestamp: 1287058521 code: KRCCOCXX timestamp: 1287058522 Interesting, don't you think? In a long sequence, the repeats are frequent and and trailing Xs... Thanks for the start. On Oct 14, 2010, at 10:53 AM, Robert Shubert wrote: > Try this out: > > <@! start with epoch> > <@ASSIGN secs <@TSTOSECS <@CURRENTTIMESTAMP>>> > > <@! add salt> > <@ASSIGN secs "<@RANDOM low=1 high=9>@@secs<@RANDOM low=1 high=9>"> > > <@! convert to base 26> > <@WHILE expr="@@secs > 26"> > > <@! shift to ascii for capitals 65-90 convert to char and build code> > <@IF "<@CURROW>%2 = 0"> > <@ASSIGN code '<@CHAR <@CALC "abs(@@secs % 26) + 65">>@@code'> > <@ELSE> > <@ASSIGN code '@@code<@CHAR <@CALC "abs(@@secs % 26) + 65">>'> > </@IF> > > <@! shift place for base conversion> > <@ASSIGN secs <@CALC "@@secs / 26" precision=0>> > > </@WHILE> > > Final Code: @@code > > DISCLAIMER: It is possible to create the same code if this routine is run > multiple times in the same second. Add a <@SLEEP 1000> to prevent this. Also, > there is an abs() in there because doing modulo on large values produces a > negative value. This is incorrect behavior on Witango's part and something > that I'll need to fix in the server. I do not think it produces a collision > problem in this routine, but it may. It is likely tied to small floating > point variable used in the routine. Oh, and there is also a rounding error > that I didn't work out, but again, it only changed some shift points (26^1 > place increases at unit=13 rather than unit=0). This can removed by > floor()ing the base conversion shift in the final @CALC. Again, I do not > believe that this causes a collision situation. Also, this routine can > occasionally create a 7 character code. You may need to check for and ignore > these if you want them all to 8 characters (This may be able to be eliminated > by increasing the LOW value in the first @RANDOM) Lastly, I don't guarantee > this routine. I just whipped it up as a mental exercise, so you may want to > test it out some (see if you get a collision over a few million iterations), > or show it to someone who is good with algorithms or cryptography. > > Robert > > -----Original Message----- > From: Roland Dumas [mailto:[email protected]] > Sent: Thursday, October 14, 2010 11:42 AM > To: [email protected] > Subject: Witango-Talk: generating unique codes > > > looking for method to create unique and non-obvious n-digit codes to be used > as discount codes. > Should be short enough to use as consumer codes (8 digit?), and probably be > something simply to enter, such as an all caps, and not have an easily > discoverable pattern. > > I want to generate unique codes and not have to check the history to see if a > code has been used before. > > Suggestions? > > > > > > ---------------------------------------- > > To unsubscribe from this list, please send an email to [email protected] > with "unsubscribe witango-talk" in the body. > > > > ---------------------------------------- > > To unsubscribe from this list, please send an email to [email protected] > with "unsubscribe witango-talk" in the body. > ---------------------------------------- To unsubscribe from this list, please send an email to [email protected] with "unsubscribe witango-talk" in the body. ---------------------------------------- To unsubscribe from this list, please send an email to [email protected] with "unsubscribe witango-talk" in the body.
