Jump to content

  • Log In with Google      Sign In   
  • Create Account


Member Since 28 Feb 2011
Online Last Active Today, 10:42 PM

Posts I've Made

In Topic: java timeout thread for connection to wrong server

Today, 10:40 PM

Don't most good high-level networking libraries provide timeout parameters or other similar constructs for just this purpose? If so, then it might be a good idea to use those rather than spawn a waiter thread just to make the connection non-blocking. Or at least it seems so to me.

In Topic: Designing a < operator for a GUID

Today, 12:30 AM

Note that these results depend on how you store the GUID. If you're storing GUIDs a word at a time then a simple memcmp will sort the GUID differently on a big-endian architecture than on a little-endian architecture. This can matter in a lot of cases you might not think about.


Yes, indeed. The GUID itself is defined as a string of bits, and the implementer should take care to store it consistently across target systems as needed. Cheers for the note since it may not have been obvious to everyone.

In Topic: Designing a < operator for a GUID

Yesterday, 11:29 PM

The "memcmp(guid1, guid2) is less than zero" relation defines a strict weak ordering and is thus suitable for use in an std::map if and only if your GUIDs have fixed, constant size. Which is almost certainly the case.




Does it compare left is less or right is less.


It doesn't really matter, any strict weak ordering will do. If you define it as "memcmp(&guid1, &guid2, sizeof(GUID)) < 0" then it compares guid1 < guid2 where < is your comparator to the map function. So if it evaluates to true, guid1 is defined to be "less" than guid2.

In Topic: [Petition] Allow fan games to be created

Yesterday, 10:40 PM


In Topic: What's a good way to play random environment sounds?

24 January 2015 - 07:24 AM

recently, i needed to play random sounds at accelerated time, which meant dividing the odds by the acceleration factor. with only about 1 in 30,000 minimum to work with and acceleration rates of 16384x and higher, i soon ran out of room. thus was born the bigdice() routine, which goes up to 1 in 100 million. all it does return dice(10000)*10000+dice(10000)-1.


Looks like bigdice never returns values less than 10000, given your description of the dice function. You probably want (dice(10000) - 1) * 10000 + dice(10000). Of course, using 0..n-1 intervals is arguably better in that it makes this sort of math simpler and less error-prone... but if it's for an N-sided die throw, I suppose...