# random number generators

Published articles for random number generators.

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

## Zero Knowledge Proofs for NP

DevFeed: [Zero Knowledge Proofs for NP](<https://devfeed.tech/articles/zero-knowledge-proofs-for-np-40402.md>)

Original publisher: [Read original article](<https://www.jeremykun.com/2016/08/01/zero-knowledge-proofs-for-np/>)

Published: 2016-08-01T08:00:53Z

Content type: tutorial

Language: en

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

Topics: [Zero-knowledge proof](<https://devfeed.tech/topics/zkp.md>), [zero-knowledge](<https://devfeed.tech/topics/zero-knowledge.md>), [Cryptography](<https://devfeed.tech/topics/cryptography.md>), [Algorithms](<https://devfeed.tech/topics/algorithms.md>), [Code](<https://devfeed.tech/topics/code.md>)

Tags: [algorithm](<https://devfeed.tech/tags/algorithm.md>), [boolean](<https://devfeed.tech/tags/boolean.md>), [circuit](<https://devfeed.tech/tags/circuit.md>), [computational-complexity](<https://devfeed.tech/tags/computational-complexity.md>), [cryptography](<https://devfeed.tech/tags/cryptography.md>), [graph-isomorphism](<https://devfeed.tech/tags/graph-isomorphism.md>), [interactive](<https://devfeed.tech/tags/interactive.md>), [mathematics](<https://devfeed.tech/tags/mathematics.md>), [np](<https://devfeed.tech/tags/np.md>), [np-hard](<https://devfeed.tech/tags/np-hard.md>), [one-way-functions](<https://devfeed.tech/tags/one-way-functions.md>), [programming](<https://devfeed.tech/tags/programming.md>), [python](<https://devfeed.tech/tags/python.md>), [random-number-generators](<https://devfeed.tech/tags/random-number-generators.md>), [variables](<https://devfeed.tech/tags/variables.md>), [zero-knowledge](<https://devfeed.tech/tags/zero-knowledge.md>)

### AI overview

This tutorial explains how zero-knowledge proofs extend beyond graph isomorphism to problems in NP, using cryptography to let a prover convince a verifier without revealing the secret knowledge behind the claim. It introduces examples including boolean formulas, subset sums, graph 3-coloring, and boolean circuits, and describes an implementation of a proof for graph 3-colorability.

### Source excerpt

Last time, we saw a specific zero-knowledge proof for graph isomorphism. This introduced us to the concept of an interactive proof, where you have a prover and a verifier sending messages back and forth, and the prover is trying to prove a specific claim to the verifier. A zero-knowledge proof is a special kind of interactive proof in which the prover has some secret piece of knowledge that makes it very easy to verify a disputed claim is true.

## Simulating a Fair Coin with a Biased Coin

DevFeed: [Simulating a Fair Coin with a Biased Coin](<https://devfeed.tech/articles/simulating-a-fair-coin-with-a-biased-coin-40342.md>)

Original publisher: [Read original article](<https://www.jeremykun.com/2014/02/08/simulating-a-fair-coin-with-a-biased-coin/>)

Published: 2014-02-08T19:03:46Z

Content type: tutorial

Language: en

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

Topics: [Computer science](<https://devfeed.tech/topics/computer-science.md>), [Mathematics](<https://devfeed.tech/topics/mathematics.md>), [Python](<https://devfeed.tech/topics/python.md>)

Tags: [algebra](<https://devfeed.tech/tags/algebra.md>), [coins](<https://devfeed.tech/tags/coins.md>), [guest-post](<https://devfeed.tech/tags/guest-post.md>), [mathematics](<https://devfeed.tech/tags/mathematics.md>), [probabilistic](<https://devfeed.tech/tags/probabilistic.md>), [python](<https://devfeed.tech/tags/python.md>), [random-number-generators](<https://devfeed.tech/tags/random-number-generators.md>), [science](<https://devfeed.tech/tags/science.md>)

### AI overview

This tutorial explains von Neumann's method for simulating a fair coin using a biased coin. It examines pairs of independent flips, discards matching pairs, returns the first result when the pair differs, and derives the expected number of flips.

### Source excerpt

This is a guest post by my friend and colleague Adam Lelkes. Adam's interests are in algebra and theoretical computer science. This gem came up because Adam gave a talk on probabilistic computation in which he discussed this technique. Problem: Simulate a fair coin given only access to a biased coin. Solution: (in Python) def fairCoin(biasedCoin): coin1, coin2 = 0,0 while coin1 == coin2: coin1, coin2 = biasedCoin(), biasedCoin() return coin1 Discussion: This is originally von Neumann's clever idea.

## Miller-Rabin Primality Test

DevFeed: [Miller-Rabin Primality Test](<https://devfeed.tech/articles/miller-rabin-primality-test-40323.md>)

Original publisher: [Read original article](<https://www.jeremykun.com/2013/06/16/miller-rabin-primality-test/>)

Published: 2013-06-16T18:55:40Z

Content type: tutorial

Language: en

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

Topics: [Python](<https://devfeed.tech/topics/python.md>), [Algorithms](<https://devfeed.tech/topics/algorithms.md>), [Algorithms, Complexity](<https://devfeed.tech/topics/algorithms-complexity.md>), [Cryptography](<https://devfeed.tech/topics/cryptography.md>)

Tags: [algorithm](<https://devfeed.tech/tags/algorithm.md>), [algorithms](<https://devfeed.tech/tags/algorithms.md>), [complexity-theory](<https://devfeed.tech/tags/complexity-theory.md>), [computational-complexity](<https://devfeed.tech/tags/computational-complexity.md>), [cryptography](<https://devfeed.tech/tags/cryptography.md>), [miller-rabin](<https://devfeed.tech/tags/miller-rabin.md>), [primes](<https://devfeed.tech/tags/primes.md>), [probabilistic](<https://devfeed.tech/tags/probabilistic.md>), [programming](<https://devfeed.tech/tags/programming.md>), [python](<https://devfeed.tech/tags/python.md>), [random-number-generators](<https://devfeed.tech/tags/random-number-generators.md>), [randomized-algorithm](<https://devfeed.tech/tags/randomized-algorithm.md>), [rsa](<https://devfeed.tech/tags/rsa.md>)

### AI overview

This tutorial explains the Miller-Rabin primality test, including its probabilistic error bound, Python implementation, and role in testing whether numbers are prime. It also discusses the algorithm's relevance to cryptography and complexity theory.

### Source excerpt

Problem: Determine if a number is prime, with an acceptably small error rate. Solution: (in Python) import random def decompose(n): exponentOfTwo = 0 while n % 2 == 0: n = n/2 exponentOfTwo += 1 return exponentOfTwo, n def isWitness(possibleWitness, p, exponent, remainder): possibleWitness = pow(possibleWitness, remainder, p) if possibleWitness == 1 or possibleWitness == p - 1: return False for _ in range(exponent): possibleWitness = pow(possibleWitness, 2, p) if possibleWitness == p - 1: return False return True def probablyPrime(p, accuracy=100): if p == 2 or p == 3: return True if p < 2: return False exponent, remainder = decompose(p - 1) for _ in range(accuracy): possibleWitness = random.

## Random (Psychedelic) Art

DevFeed: [Random (Psychedelic) Art](<https://devfeed.tech/articles/random-psychedelic-art-40252.md>)

Original publisher: [Read original article](<https://www.jeremykun.com/2012/01/01/random-psychedelic-art/>)

Published: 2012-01-01T19:11:28Z

Content type: tutorial

Language: en

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

Topics: [Python](<https://devfeed.tech/topics/python.md>), [classes](<https://devfeed.tech/topics/classes.md>), [Programming](<https://devfeed.tech/topics/programming.md>), [Code](<https://devfeed.tech/topics/code.md>)

Tags: [art](<https://devfeed.tech/tags/art.md>), [classes](<https://devfeed.tech/tags/classes.md>), [code](<https://devfeed.tech/tags/code.md>), [color](<https://devfeed.tech/tags/color.md>), [how-to](<https://devfeed.tech/tags/how-to.md>), [kolmogorov-complexity](<https://devfeed.tech/tags/kolmogorov-complexity.md>), [pixel](<https://devfeed.tech/tags/pixel.md>), [primer](<https://devfeed.tech/tags/primer.md>), [programming](<https://devfeed.tech/tags/programming.md>), [python](<https://devfeed.tech/tags/python.md>), [random-number-generators](<https://devfeed.tech/tags/random-number-generators.md>)

### AI overview

A Python tutorial that introduces objects and classes while constructing randomized psychedelic art. It explains how images are represented as pixel grids with RGB color values and uses mathematical functions to generate colors.

### Source excerpt

And a Pinch of Python Next semester I am a lab TA for an introductory programming course, and it's taught in Python. My Python experience has a number of gaps in it, so we'll have the opportunity for a few more Python primers, and small exercises to go along with it. This time, we'll be investigating the basics of objects and classes, and have some fun with image construction using the Python Imaging Library.