Skip to content

Instantly share code, notes, and snippets.

@uncommoncode
uncommoncode / randomized_response.ipynb
Last active Jun 20, 2016
Randomized Response Function for Differential Privacy
View randomized_response.ipynb
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
View randomized_response.py
import random
def randomized_response(true_response):
"""
Return a randomized response giving plausible deniability to a query about our true response value. This allows us to run
queries across a population while preserving individual privacy.
Parameters
---
true_response : boolean
View Random Variable Modulo Addition.ipynb
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
@uncommoncode
uncommoncode / FloatPacking.frag
Last active Dec 9, 2020
Stuff a 3 component vector into a single floating point component.
View FloatPacking.frag
/*
* The number of bits of precision per color channel are log_2(c_precision),
* in this case 7 bits per color, or 21 bits total.
*
* A c_precision of 128 fits within 7 base-10 digits.
*
* NOTE: an IEEE 754 float can only express 7 digits exactly for all digits.
*/
const float c_precision = 128.0;
const float c_precisionp1 = c_precision + 1.0;
@uncommoncode
uncommoncode / OpenThreadsExample.cpp
Last active Aug 29, 2015
Example code for OpenThreads
View OpenThreadsExample.cpp
#include <OpenThreads/Thread>
class Thread : public OpenThreads::Thread
{
public:
Thread() : OpenThreads::Thread()
{
// initializer code here
}
virtual void run()