[tor-bugs] #28878 [Core Tor/Tor]: WTF-PAD: Improve deterministic randomness in tests
Tor Bug Tracker & Wiki
blackhole at torproject.org
Tue Dec 18 12:30:55 UTC 2018
#28878: WTF-PAD: Improve deterministic randomness in tests
-------------------------------------------------+-------------------------
Reporter: asn | Owner: (none)
Type: defect | Status: new
Priority: Medium | Milestone: Tor:
| unspecified
Component: Core Tor/Tor | Version:
Severity: Normal | Resolution:
Keywords: wtf-pad, tor-relay, tor-cell, | Actual Points:
padding, tor-tests |
Parent ID: #28637 | Points:
Reviewer: | Sponsor:
-------------------------------------------------+-------------------------
Comment (by asn):
{{{
< Riastradh> asn: How to increment a counter in a machine-independent way:
unsigned i, t = 1; for (i = 0; i < arraycount(ctr); i++) { t = ctr[i] + 1;
ctr[i] = t
& 0xff; t >>= 8; }
< Riastradh> (You can assert(t == 0) at the end, but there's really no
need if arraycount(ctr) >= 8 and ctr starts at zero.)
< Riastradh> asn: Tiny nit in the comments: change `set the expected log-
probability' to `set the log-probability of the null hypothesis' or `set
logP to the
logarithm of the expected frequency under the null
hypothesis'.
< Riastradh> asn: In particular, log E[X] generally not E[log X]. E.g.,
if P(0) = 1/2, P(1) = 1/4, P(2) = P(3) = 1/8, then log E[P(x)] = log 11/32
~= -1.07, but
E[log P(x)] ~= -1.21.
< Riastradh> asn: How to paint a 32-bike shed: for (i = 0; i < 32; i++) {
paintf("%02x", shed[i]); }
< Riastradh> asn: Correction to my off-the-cuff IRC code: not { t = ctr[i]
+ 1; ...} but { t = ctr[i] + t; ... }, or just { t += ctr[i]; ... }.
}}}
--
Ticket URL: <https://trac.torproject.org/projects/tor/ticket/28878#comment:2>
Tor Bug Tracker & Wiki <https://trac.torproject.org/>
The Tor Project: anonymity online
More information about the tor-bugs
mailing list