# practical math

Published articles for practical math.

This is one page of public article previews, not the complete archive. Follow Next page to continue. Summaries are not the original full articles.

## "Practical Math" Preview: Collect Sensitive Survey Responses Privately

DevFeed: ["Practical Math" Preview: Collect Sensitive Survey Responses Privately](<https://devfeed.tech/articles/practical-math-preview-collect-sensitive-survey-responses-privately-40454.md>)

Original publisher: [Read original article](<https://www.jeremykun.com/2022/05/14/practical-math-preview-collect-sensitive-survey-responses-privately/>)

Published: 2022-05-14T09:40:49Z

Content type: tutorial

Language: en

Sources: [Jeremy Kun](<https://devfeed.tech/sources/jeremy-kun.md>)

Topics: [math](<https://devfeed.tech/topics/math.md>), [Statistics](<https://devfeed.tech/topics/statistics.md>), [Code](<https://devfeed.tech/topics/code.md>), [Software](<https://devfeed.tech/topics/software.md>)

Tags: [bias](<https://devfeed.tech/tags/bias.md>), [code](<https://devfeed.tech/tags/code.md>), [collect](<https://devfeed.tech/tags/collect.md>), [differential-privacy](<https://devfeed.tech/tags/differential-privacy.md>), [mathematics](<https://devfeed.tech/tags/mathematics.md>), [politics](<https://devfeed.tech/tags/politics.md>), [practical](<https://devfeed.tech/tags/practical.md>), [practical-math](<https://devfeed.tech/tags/practical-math.md>), [privacy](<https://devfeed.tech/tags/privacy.md>), [programming](<https://devfeed.tech/tags/programming.md>), [python](<https://devfeed.tech/tags/python.md>), [random](<https://devfeed.tech/tags/random.md>), [randomized-algorithm](<https://devfeed.tech/tags/randomized-algorithm.md>), [research](<https://devfeed.tech/tags/research.md>), [responses](<https://devfeed.tech/tags/responses.md>), [survey](<https://devfeed.tech/tags/survey.md>)

### AI overview

This chapter preview explains randomized response, a survey technique for estimating aggregate statistics about sensitive questions while preserving respondents' privacy. Respondents use private coin flips to introduce randomization and maintain plausible deniability.

### Source excerpt

This is a draft of a chapter from my in-progress book, Practical Math for Programmers: A Tour of Mathematics in Production Software. Tip: Determine an aggregate statistic about a sensitive question, when survey respondents do not trust that their responses will be kept secret. Solution: import random def respond_privately(true_answer: bool) -> bool: '''Respond to a survey with plausible deniability about your answer.''' be_honest = random.random() < 0.5 random_answer = random.random() < 0.