Common subdirectories: uuid_old/translations and uuid/translations
diff -up uuid_old/uuid.admin.inc uuid/uuid.admin.inc
--- uuid_old/uuid.admin.inc	2010-09-08 17:07:14.000000000 +0100
+++ uuid/uuid.admin.inc	2010-09-15 14:51:30.000000000 +0100
@@ -79,6 +79,27 @@ function uuid_admin() {
     ),
     '#description' => t('Should UUIDs be created automatically for comments?'),
   );
+  
+  $gen_method_options = array();
+  if ($GLOBALS['db_type'] != 'pgsql') {
+    $gen_method_options['mysql'] = t('MySQL SELECT UUID()');
+  }
+  if(function_exists('uuid_create')) {
+    $gen_method_options['pecl'] = t('PECL uuid_create()');
+  }
+  $gen_method_options['rfc4122_v4'] = t('RFC 4122 Version 4');
+  
+  $form['method'] = array(
+    '#type' => 'fieldset',
+    '#title' => t('UUID generation method'),
+  );
+  $form['method']['uuid_generation_method'] = array(
+    '#type' => 'radios',
+    '#title' => t('Select the UUID generation method'),
+    '#default_value' => variable_get('uuid_generation_method', uuid_default_generation_method()),
+    '#options' => $gen_method_options,
+    '#description' => t('Different UUID generation methods have different qualities in terms of optical randomness, clash safety and compliance with UUID version definitions.'),
+  );
 
   $form['settings'] = array(
     '#type' => 'fieldset',
diff -up uuid_old/uuid.module uuid/uuid.module
--- uuid_old/uuid.module	2010-09-08 17:07:14.000000000 +0100
+++ uuid/uuid.module	2010-09-15 14:54:06.000000000 +0100
@@ -243,6 +243,18 @@ function uuid_is_valid($uuid) {
 }
 
 /**
+ * Selects the default UUID generation method based on predefined priorities and availability of packages.
+ */
+function uuid_default_generation_method() {
+  if ($GLOBALS['db_type'] != 'pgsql') {
+    return 'mysql';
+  } else if (function_exists('uuid_create')) {
+    return 'pecl';
+  }
+  return 'rfc4122_v4';
+}
+
+/**
  * Generate and return an Universally Unique IDentifier (UUID).
  *
  * @see http://www.ietf.org/rfc/rfc4122.txt
@@ -252,30 +264,33 @@ function uuid_is_valid($uuid) {
  *   An UUID, made up of 32 hex digits and 4 hyphens.
  */
 function uuid_uuid() {
-  // If we're not using postgres, the database will give us a UUID.
-  if ($GLOBALS['db_type'] != 'pgsql') {
-    return db_result(db_query('SELECT UUID()'));
+  $generation_method = variable_get('uuid_generation_method', uuid_default_generation_method());
+  switch ($generation_method) {
+    case 'mysql':
+      // If we're not using postgres, the database will give us a UUID.
+      return db_result(db_query('SELECT UUID()'));
+      break;
+    case 'pecl':
+      // If the function provided by the uuid pecl extension is available, use that.
+      return uuid_create(UUID_TYPE_DEFAULT);
+      break;
+    case 'rfc4122_v4':
+      // Fall back to generating a Universally Unique IDentifier version 4.
+      // Base on http://php.net/manual/en/function.uniqid.php#65879
+      // The field names refer to RFC 4122 section 4.1.2.
+      return sprintf('%04x%04x-%04x-%03x4-%04x-%04x%04x%04x',
+        // 32 bits for "time_low".
+        mt_rand(0, 65535), mt_rand(0, 65535),
+        // 16 bits for "time_mid".
+        mt_rand(0, 65535),
+        // 12 bits before the 0100 of (version) 4 for "time_hi_and_version".
+        mt_rand(0, 4095),
+        bindec(substr_replace(sprintf('%016b', mt_rand(0, 65535)), '01', 6, 2)),
+        // 8 bits, the last two of which (positions 6 and 7) are 01, for "clk_seq_hi_res"
+        // (hence, the 2nd hex digit after the 3rd hyphen can only be 1, 5, 9 or d)
+        // 8 bits for "clk_seq_low" 48 bits for "node".
+        mt_rand(0, 65535), mt_rand(0, 65535), mt_rand(0, 65535)
+      );
+      break;
   }
-
-  // If the function provided by the uuid pecl extension is available, use that.
-  if(function_exists('uuid_create')) {
-    return uuid_create(UUID_TYPE_DEFAULT);
-  }
-
-  // Fall back to generating a Universally Unique IDentifier version 4.
-  // Base on http://php.net/manual/en/function.uniqid.php#65879
-  // The field names refer to RFC 4122 section 4.1.2.
-  return sprintf('%04x%04x-%04x-%03x4-%04x-%04x%04x%04x',
-    // 32 bits for "time_low".
-    mt_rand(0, 65535), mt_rand(0, 65535),
-    // 16 bits for "time_mid".
-    mt_rand(0, 65535),
-    // 12 bits before the 0100 of (version) 4 for "time_hi_and_version".
-    mt_rand(0, 4095),
-    bindec(substr_replace(sprintf('%016b', mt_rand(0, 65535)), '01', 6, 2)),
-    // 8 bits, the last two of which (positions 6 and 7) are 01, for "clk_seq_hi_res"
-    // (hence, the 2nd hex digit after the 3rd hyphen can only be 1, 5, 9 or d)
-    // 8 bits for "clk_seq_low" 48 bits for "node".
-    mt_rand(0, 65535), mt_rand(0, 65535), mt_rand(0, 65535)
-  );
 }
