-
Notifications
You must be signed in to change notification settings - Fork 147
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Normally-distributed random numbers #101
Comments
Reasonable. I'm on vacation until next week, and probably won't get a chance to write a more detailed response until I return, but a couple quick things to consider:
|
Yes please :) Here's TensorFlow's version, for reference. |
I wonder—is
If it is well-optimized, then for use-cases that require multiple values a sequence can be built two at a time. And when only one number is needed, a convenience method can provide it.
|
No need; when the host system libm provides |
My question was not whether we need to write My question was whether we should design the API to include a function which generates pairs of normally-distributed values. |
Oh, well, that doesn't require anything of |
Note that the paper you cite introduces an attack that applies only to floating-point algorithms (more-specifically, floating-point implementations of the Laplacian distribution); as the paper says: "Fixed-point or integer-valued algorithms are immune to our attack". In fact, as I write in "Randomization with Real Numbers", "random non-integer numbers are rarely if ever seen in serious information security applications", and I wasn't much aware of the use of floating-point numbers in differential privacy until today. I can't think of a security application where random integers (or at most random fixed-point numbers) could not have been used instead of random floating-point numbers. Also, as for generating normally-distributed random numbers, the Box-Muller transform is only one possibility, and is not the only one that generates pairs of numbers at a time (another is the polar method). Other possibilities include ratio of uniforms, CDF inversion, Karney's algorithm, and ziggurat, which don't necessarily generate pairs of random numbers. |
It is common to need a random sample from either a real or complex normal distribution.
The standard library provides static
random(in:)
methods which sample uniformly, in a constrained extension ofBinaryFloatingPoint
. (The constraint isRawSignificand: FixedWidthInteger
.)I propose that we add similar functionality for sampling from a normal distribution on
Real
andComplex
with the corresponding constraints.The text was updated successfully, but these errors were encountered: