Timeline for Get random direction based off of location and previous direction
Current License: CC BY-SA 3.0
6 events
| when toggle format | what | by | license | comment | |
|---|---|---|---|---|---|
| Mar 18, 2015 at 23:35 | comment | added | Obicere | Due to the nature of the question, I've gone with this one. Just a few runs shows that this method can be ran millions of times, so even a small improvement is huge. I also was aiming entirely for speed, which this achieved. | |
| Mar 18, 2015 at 23:34 | vote | accept | Obicere | ||
| Mar 18, 2015 at 9:46 | comment | added | h.j.k. | BTW sharing your test code may be useful too... ^_^ | |
| Mar 18, 2015 at 9:25 | comment | added | JS1 | @h.j.k. It would work but it would be slower. Since the bitmask is limited to four bits the array lookup only needs 16 bytes. If there were more than 8 bits or so, I would switch to using thebitCount function to not use an excessive amount of space. | |
| Mar 18, 2015 at 9:21 | comment | added | h.j.k. | For NumDirections, will Integer.bitCount() be a suitable replacement as well? | |
| Mar 18, 2015 at 8:54 | history | answered | JS1 | CC BY-SA 3.0 |