[random] Shuffle
authorBehdad Esfahbod <behdad@behdad.org>
Tue, 11 Sep 2018 08:51:19 +0000 (10:51 +0200)
committerBehdad Esfahbod <behdad@behdad.org>
Tue, 11 Sep 2018 08:51:19 +0000 (10:51 +0200)
src/hb-ot-layout-gsub-table.hh
src/hb-ot-layout-gsubgpos.hh

index dfa5097..4d5db6a 100644 (file)
@@ -543,10 +543,7 @@ struct AlternateSet
 
     /* If alt_index is MAX, randomize feature if it is the rand feature. */
     if (alt_index == HB_OT_MAP_MAX_VALUE && c->random)
-    {
-      c->random_state = (0x5DEECE66Dull * c->random_state + 11) & (((uint64_t) 1 << 48) - 1);
-      alt_index = (c->random_state >> 32) % count + 1;
-    }
+      alt_index = c->random_number () % count + 1;
 
     if (unlikely (alt_index > count || alt_index == 0)) return_trace (false);
 
index be1b449..cb71759 100644 (file)
@@ -521,6 +521,12 @@ struct hb_ot_apply_context_t :
     iter_context.init (this, true);
   }
 
+  inline uint32_t random_number (void)
+  {
+    random_state = (0x5DEECE66Dull * random_state + 11) & (((uint64_t) 1 << 48) - 1);
+    return random_state >> 32;
+  }
+
   inline bool
   match_properties_mark (hb_codepoint_t  glyph,
                         unsigned int    glyph_props,