A $5 word I use often enough to probably quickly define here.
If something is *deterministic*, that means **there is no element of randomness involved**. Basically, given the inputs you can **determine** the outputs absolutely and repeatedly.
Deterministic:
- Same inputs → **always** same outputs
Non-deterministic:
- Same inputs → *usually* same outputs
- Same inputs → different outputs
Deterministic:
```javascript
let myNum = 6; //no randomness in assignment
if(myNum > 3){
return "WAS BIG" //returns this 100% of the time
}
return "WAS NOT BIG"
```
Non-deterministic:
```javascript
let myDiceRoll = randomIntFromInterval(1, 6); //randomly assigned
if(myDiceRoll > 3){
return "WAS BIG" //returns this 50% of the time
}
return "WAS NOT BIG" //returns this 50% of the time
function randomIntFromInterval(min, max) { // min and max included
return Math.floor(Math.random() * (max - min + 1) + min);
}
const rndInt = randomIntFromInterval(1, 6);
console.log(rndInt);
```
```
****
# More
## Source
- Myself