Don't seed the RNG from the contents of the buffer
diff --git a/src/hb-ot-layout-gsubgpos.hh b/src/hb-ot-layout-gsubgpos.hh
index 113433d..3a028f3 100644
--- a/src/hb-ot-layout-gsubgpos.hh
+++ b/src/hb-ot-layout-gsubgpos.hh
@@ -503,16 +503,13 @@
auto_zwnj (true),
auto_zwj (true),
random (false),
- random_state (0),
+ random_state (1),
has_glyph_classes (gdef.has_glyph_classes ()) {}
inline void set_lookup_mask (hb_mask_t mask) { lookup_mask = mask; }
inline void set_auto_zwj (bool auto_zwj_) { auto_zwj = auto_zwj_; }
inline void set_auto_zwnj (bool auto_zwnj_) { auto_zwnj = auto_zwnj_; }
- inline void set_random_state (uint64_t random_state_) {
- random = true;
- random_state = random_state_;
- }
+ inline void set_random (bool random_) { random = random_; }
inline void set_recurse_func (recurse_func_t func) { recurse_func = func; }
inline void set_lookup_index (unsigned int lookup_index_) { lookup_index = lookup_index_; }
inline void set_lookup_props (unsigned int lookup_props_)
diff --git a/src/hb-ot-layout.cc b/src/hb-ot-layout.cc
index b31dbbc..51c1198 100644
--- a/src/hb-ot-layout.cc
+++ b/src/hb-ot-layout.cc
@@ -1270,10 +1270,7 @@
c.set_auto_zwnj (lookups[table_index][i].auto_zwnj);
if (lookups[table_index][i].random)
{
- uint64_t random_state = 1;
- for (unsigned int j = 0; j < buffer->len; j++)
- random_state = 31 * random_state + buffer->info[j].codepoint;
- c.set_random_state (random_state);
+ c.set_random (true);
buffer->unsafe_to_break_all ();
}
apply_string<Proxy> (&c,
diff --git a/test/shaping/data/in-house/tests/rand.tests b/test/shaping/data/in-house/tests/rand.tests
index f1023e8..781abf4 100644
--- a/test/shaping/data/in-house/tests/rand.tests
+++ b/test/shaping/data/in-house/tests/rand.tests
@@ -1,3 +1,3 @@
../fonts/5bb74492f5e0ffa1fbb72e4c881be035120b6513.ttf:--no-glyph-names --features=-rand:U+0054,U+0055,U+0056:[1=0+560|2=1+602|3=2+602]
../fonts/5bb74492f5e0ffa1fbb72e4c881be035120b6513.ttf:--no-glyph-names --features=rand=2:U+0054,U+0055,U+0056:[5=0+560|8=1+602|11=2+602]
-../fonts/5bb74492f5e0ffa1fbb72e4c881be035120b6513.ttf:--no-glyph-names:U+0054,U+0055,U+0056,U+0054,U+0055,U+0056,U+0054,U+0055,U+0056,U+0054,U+0055,U+0056:[4=0+560|7=1+602|11=2+602|6=3+560|8=4+602|10=5+602|5=6+560|9=7+602|10=8+602|5=9+560|7=10+602|12=11+602]
+../fonts/5bb74492f5e0ffa1fbb72e4c881be035120b6513.ttf:--no-glyph-names:U+0054,U+0055,U+0056,U+0054,U+0055,U+0056,U+0054,U+0055,U+0056,U+0054,U+0055,U+0056:[6=0+560|9=1+602|10=2+602|6=3+560|9=4+602|12=5+602|5=6+560|8=7+602|11=8+602|6=9+560|8=10+602|10=11+602]