A Flash Developer Resource Site

Results 1 to 14 of 14

Thread: [RESOLVED] How do you get a unique ID from two numbers w/o ordering them?

Hybrid View

  1. #1
    Senior Member joshstrike's Avatar
    Join Date
    Jan 2001
    Location
    Alhama de Granada, España
    Posts
    1,136
    I think... if I didn't need f(x,y) == f(y,x), and assuming only positive integers where x != y, I could generate a unique number for each pair by doing (x*y)+y ...which gives a hyperbolic paraboloid.
    However, that is dependent on the order f(x,y) and doesn't help my situation because I need a key by which to group both ways.

    I've gone ahead and solved my problem by using CONCAT(MIN(userID),',',MAX(userID)) to generate a unique identifier, but unfortunately this is rather slow.

  2. #2
    Senior Member realMakc's Avatar
    Join Date
    Oct 2002
    Posts
    923
    I could generate a unique number for each pair by doing (x*y)+y
    suppose you have some z = (x*y)+y. then, for some x1 != x you can find y1 = z / (x1 + 1), so that x1*y1 + y1 is the same z.
    who is this? a word of friendly advice: FFS stop using AS2

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  




Click Here to Expand Forum to Full Width

HTML5 Development Center