Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- function codeforESL() {
- const kekNUT = ["Gold", "Silver"]
- const yourMomsBox = [];
- function shieet() {
- return Math.random() > 0.5 ? 0 : 1;
- }
- function NUT() {
- return kekNUT[shieet()];
- }
- // A magical Egyption frog god randomly chooses either a gold or a silver orb and places the orb in a box
- yourMomsBox.push(NUT());
- // He again chooses another orb that is also randomly either gold or silver and places it in the same box
- yourMomsBox.push(NUT());
- // There are now two orbs in the box, each of which can be either gold or silver.
- // console.log(yourMomsBox.length);
- // You did not see him choose the orbs, and you cannot see into the box.
- // However, a Jewish rabbi with an extraordinary sense of smell, informs you that he can detect the scent of gold coming from that box.
- // This tells you that there is at least one golden orb in side the box.
- yourMomsBox[shieet()] = "Gold";
- return yourMomsBox;
- }
- function its50Percent() {
- let bothGold = 0;
- let N = 1000000
- for (let index = 0; index < N; index++) {
- const [leftNUT, rightNUT] = codeforESL();
- if (leftNUT === "Gold" && rightNUT === "Gold") {
- bothGold++;
- }
- }
- console.log(`${bothGold} out of ${N} are gold. ${bothGold / N}`);
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement