[random] Switch to 32bit RNG

This commit is contained in:
Behdad Esfahbod 2018-09-11 10:57:48 +02:00
parent 08260c708a
commit cfdea88475
2 changed files with 6 additions and 5 deletions

View File

@ -484,7 +484,7 @@ struct hb_ot_apply_context_t :
bool auto_zwj; bool auto_zwj;
bool random; bool random;
uint64_t random_state; uint32_t random_state;
hb_ot_apply_context_t (unsigned int table_index_, hb_ot_apply_context_t (unsigned int table_index_,
@ -523,8 +523,9 @@ struct hb_ot_apply_context_t :
inline uint32_t random_number (void) inline uint32_t random_number (void)
{ {
random_state = (0x5DEECE66Dull * random_state + 11) & (((uint64_t) 1 << 48) - 1); /* http://www.cplusplus.com/reference/random/minstd_rand/ */
return random_state >> 32; random_state = random_state * 48271 % 2147483647;
return random_state;
} }
inline bool inline bool

View File

@ -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: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 --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:[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] ../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:[5=0+560|7=1+602|10=2+602|4=3+560|7=4+602|10=5+602|6=6+560|9=7+602|10=8+602|5=9+560|8=10+602|12=11+602]