Questions tagged [collision]

The intersection of one or more objects or concepts, such as communications packets or function names. For questions about collision detection (in computer graphics) use the [collision-detection] tag instead.

May be used to describe graphical elements (as in a game setting), networking (when multiple packets arrive at the same location simultaneously), RF communication when transmissions overlap and interrupt one another or in programming when disparate functions have similar naming conventions (see also namespace).

For questions about collision detection (in computer graphics) use instead.


Related tags

2826 questions
238
votes
5 answers

Likelihood of collision using most significant bits of a UUID in Java

If I'm using Long uuid = UUID.randomUUID().getMostSignificantBits() how likely is it to get a collision. It cuts off the least significant bits, so there is a possibility that you run into a collision, right?
dlinsin
  • 17,231
  • 13
  • 39
  • 51
202
votes
2 answers

Why are my balls disappearing?

Pardon the funny title. I've created a little graphic demo of 200 balls bouncing and colliding, both against the walls and each other. You can see what I have currently here: http://www.exeneva.com/html5/multipleBallsBouncingAndColliding/ The…
Yang Pulse
  • 2,009
  • 1
  • 11
  • 13
130
votes
7 answers

Is it safe to assume a GUID will always be unique?

I know there is a minute possibility of a clash but if I generated a batch of 1000 GUIDs (for example), would it be safe to assume they're all unique to save testing each one? Bonus question An optimal way to test a GUID for uniqueness? Bloom filter…
Tom Savage
  • 3,102
  • 3
  • 29
  • 31
96
votes
6 answers

Collisions when generating UUIDs in JavaScript

This relates to this question. I am using the code below from this answer to generate a UUID in JavaScript: 'xxxxxxxx-xxxx-4xxx-yxxx-xxxxxxxxxxxx'.replace(/[xy]/g, function(c) { var r = Math.random()*16|0, v = c == 'x' ? r : (r&0x3|0x8); …
Muxa
  • 5,473
  • 6
  • 43
  • 54
88
votes
3 answers

How to deal with symbol collisions between statically linked libraries?

One of the most important rules and best practices when writing a library, is putting all symbols of the library into a library specific namespace. C++ makes this easy, due to the namespace keyword. In C the usual approach is to prefix the…
datenwolf
  • 149,702
  • 12
  • 167
  • 273
73
votes
7 answers

Efficient (and well explained) implementation of a Quadtree for 2D collision detection

I've been working on adding a Quadtree to a program that I'm writing, and I can't help but notice that there are few well explained/performing tutorials for the implementation that I'm looking for. Specifically, a list of the methods and pseudocode…
Zimri Leisher
  • 936
  • 1
  • 8
  • 12
59
votes
9 answers

What is a good 64bit hash function in Java for textual strings?

I'm looking for a hash function that: Hashes textual strings well (e.g. few collisions) Is written in Java, and widely used Bonus: works on several fields (instead of me concatenating them and applying the hash on the concatenated string) Bonus:…
ripper234
  • 202,011
  • 255
  • 600
  • 878
49
votes
4 answers

Modules and namespace / name collision in AngularJS

Consider the following jfiddle http://jsfiddle.net/bchapman26/9uUBU/29/ //angular.js example for factory vs service var app = angular.module('myApp', ['module1', 'module2']); var service1module = angular.module('module1',…
Brian Chapman
  • 1,286
  • 2
  • 12
  • 17
46
votes
2 answers

Probability of collision when using a 32 bit hash

I have a 10 character string key field in a database. I've used CRC32 to hash this field but I'm worry about duplicates. Could somebody show me the probability of collision in this situation? p.s. my string field is unique in the database. If the…
nguyenngoc101
  • 1,051
  • 2
  • 15
  • 26
33
votes
3 answers

Quadtree for 2D collision detection

I'm trying to use a quadtree for 2D collision detection, but I'm a little stumped on how to implement it. First of all, I'd have a quadtree which contains four subtrees (one representing each quadrant), as well as a collection of objects which don't…
bfops
  • 4,428
  • 4
  • 28
  • 41
30
votes
5 answers

Algorithm to find solution to puzzle

I am trying to make a game where a player has to find his way from Start to End on the Game Board. As you see this Game Board contains a bunch of red circular obstacles. To win the game the player has to remove a minimum amount of obstacles. So my…
Cheesebaron
  • 21,926
  • 13
  • 60
  • 110
24
votes
1 answer

Collision detection with complex shapes

I am wanting to make a game that has each level loaded from an image. I want to draw up the whole level in Photoshop, and then set it as the background and allow the player to walk over it. I want another invisible image to go over top which will be…
calebmanley
  • 401
  • 4
  • 16
21
votes
4 answers

What Exactly is Hash Collision

Hash Collision or Hashing Collision in HashMap is not a new topic and I've come across several blogs and discussion boards explaining how to produce Hash Collision or how to avoid it in an ambiguous and detailed way. I recently came across this…
sribasu
  • 627
  • 2
  • 5
  • 23
20
votes
8 answers

How do I avoid name collision with macros defined in Windows header files?

I have some C++ code that includes a method called CreateDirectory(). Previously the code only used STL and Boost, but I recently had to include so I could look-up CSIDL_LOCAL_APPDATA. Now, this…
Mike Willekes
  • 5,570
  • 9
  • 30
  • 33
20
votes
13 answers

Algorithm for Gift Card Codes

I recently posted this question about codes for a gift-card-like voucher that users can redeem online. I wanted to find the best tradeoff between large keyspace, low guessability, and human readability. Now that I'm into implementation I realize…
James Orr
  • 4,698
  • 6
  • 35
  • 60
1
2 3
99 100