**What I know:**

with R as a random variable from a discrete uniform distribution of 1000 numbers [1, 1000]. there is a 1/1000 chance to have R=123 (or any other number in [1, 1000])

**What I think I know:**

so if we test this 1000 times, there must be a "good" chance to see some R=123. (good chance is a probability near 1).

**First question:** AM I RIGHT ?

**Second question:** why is the said probability around 0.63 ?

0.63 comes from testing with below algorithm in 3 languages (so if there is a problem with the algorithm or if you think the random generators used in the codes doesn't produce uniform distribution, please point it out)

Maybe, **Third question:** If the algorithm does not approximate the said probability, please explain what does it approximate and why does it give 0.63

**Algorithm:**
```
test:
with a random number NUM from [0, 999]
see if R=NUM at least once in 1000 times

try:
run the test 10000 times.
how many times did the test come true ? divide by 10000.
```

**The codes:**

python:
```python
import random
import math

def r():
    return math.floor(random.random()*1000)
def test():
    num = r()
    for i in range(1000):
        if r()==num:
        return True
    return False

q = 0
for i in range(10000):
    if test():
        q += 1
 
print(q / 10000)
```

js:
```js
let r = () => Math.floor(Math.random()*1000)
let test = () => {
    let num = r()
    for(let i = 0; i < 1000; i ++)
        if(num===r()) return true
    return false
}

let q = 0
for(let i = 0; i < 10000; i ++)
    if(test()) q++

console.log(q / 10000)
```

cpp:
```c++
#include <iostream>
#include <stdlib.h>
using namespace std;

int r() {
    return rand() % 1000;
}

bool test() {
    int num = r();
    for(int i = 0; i < 1000; i ++) {
        if(r()==num) {
            return true;
        }
    }
    return false;
}

int main() {
    srand(1267);

    int q = 0;
    for(int i = 0; i < 100000; i ++) {
        if(test()) {
            q ++;
        }
    }
    cout << ((double)q/100000) << endl;
	
    return 0;
}
```