forked from tula3and/random-question-generator
-
Notifications
You must be signed in to change notification settings - Fork 1
/
intro_doc.py
115 lines (76 loc) · 5.12 KB
/
intro_doc.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
import streamlit as st
def intro_1():
st.title("Quantum Lottery Game")
st.write(
"""
### 1) Let's generate *real random number* using IBM Quantum Computer
- Real random number generation for lottery-game using IBM quantum computer
**[IBM Qiskit library](https://qiskit.org/)**
---
### 2) What is *real* random number generation?
- "**Random number generation(RNG)** is a sequence of numbers or symbols that cannot be reasonably predicted better than by random chance is generated.
This means that the particular outcome sequence will contain some patterns detectable in hindsight but **unpredictable** to foresight"(Wikipedia)
- There are two method for [RNG](https://en.wikipedia.org/wiki/Random_number_generation)
- **"True" random number generation(TRNG)** uses measurement of some physical phenomenon that is expected to be random and then compensates
for possible biases in the measurement process
- **"Pseudo" random number generation(PRNG)** uses computational algorithm that can produce long sequences of apparently random results,
which are in fact completely determined by a shorter initial value, known as a seed value or key
- In this application, we use IBM cloud quantum computer to generate real random number using the **superpositon** of the qubit states.
- There are some way for generating random number using **[Qiskit(Quantum Information Software Kit)](https://qiskit.org/)**
- 1) **Qiskit RNG**
- It needed IBM Quantum account for IBM Quantum backends. So, skip this method for this application.
If you want to use this library, check this links below
- https://qiskit.org/documentation/apidoc/ibmq_random.html
- https://github.com/qiskit-community/qiskit_rng/
- 2) **Qauntum circuit** based random number generation. **[IBM Quantum system](https://quantum-computing.ibm.com/services/docs/services/manage/systems/)** services cryogenic based quantum processor
- Using this cloud based quantum computer, we could make quantum circuit for specific operation
- In this application we use the "**[H(Hadamard) gate](https://learn.qiskit.org/course/ch-states/single-qubit-gates#hgate)**" for
**"[superposition](https://en.wikipedia.org/wiki/Quantum_superposition)"** and "**[CRY gate](https://qiskit.org/documentation/stubs/qiskit.circuit.QuantumCircuit.cry.html)**" for **"[entanglement](https://en.wikipedia.org/wiki/Quantum_entanglement)"** between the qubits
*<Superposition>*
- state of the single qubit has 50/50 measurement probability of |0⟩/|1⟩ state
*<Entanglement>*
- Actually, because of the 'RNG generation time' and 'IBM Q account problem', we didn't used 'Real' device.
- We use the **[Qasm simulator](https://qiskit.org/documentation/stubs/qiskit.providers.aer.QasmSimulator.html)** as backend which mimic an IBMQ backend.
""")
def intro_2():
st.write(
"""
---
### 3) There are two mode for random number generation
#### A) Simple random number generation using quantum circuit using qiskit library
""")
def intro_3():
st.write(
"""
#### B) Birth-day entangled random number generation
- Add two qubits for entanglement
- Applying user's birth-day as a rotational angle of Ry gate
- Add controlled rotational y gate on birth-day qubits and RNG qubits
- Your birth-day will make some bias to the controlled qubits
""")
def intro_4():
st.write(
"""
---
### 4) Serviced Lottery Game
- **[Lotto(Korea)](https://dhlottery.co.kr/)**
: Select 6 numbers in range 45
- **[Powerball(USA)](https://www.powerball.com/)**
: Select 5 numbers in range 70 for 'white ball', 1 more selection in range 25 for 'power ball'
- **[Lotto India(India)](https://www.lotto.in/)**
: Select 6 numbers in the range 50 and select one 'Joker Ball' in the range 5
- **[Lotto7(Japan)](https://en.lottolyzer.com/how-to-play/japan/lotto-7)**
: Select 7 numbers in the range 37
- **[French Lottery(France)](http://france-lottery.com/)**
: Select 5 numbers in the range 49 and select one 'Lucky number' in the range 10
- **Custom**
: Customize your Q-lottery-game
---
### 5) Caution!!
- Although real random number generated by QC is more random than pseudo random number,
it does not guarantee winning of the lottery!!
- Just use it for fun!
---
### 6) Contribution
- If you want to add another "Lottery game", follow the form and send PR to **[github](https://github.com/Denny-Hwang/q-lottery-game)**
""")