Skip to content

Commit

Permalink
feat: 整理daily参考答案到backlog
Browse files Browse the repository at this point in the history
  • Loading branch information
luzhipeng committed Jun 14, 2019
1 parent 2abdabc commit a3d96e7
Show file tree
Hide file tree
Showing 7 changed files with 16 additions and 0 deletions.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
16 changes: 16 additions & 0 deletions backlog/daily/threeDoors.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
// true 代表换之后赢了
// false 代表换了之后输了
function threeDoors() {
const doors = [0, 0, 1];
const random = Math.random() * doors.length;
const pos = Math.floor(random);
if (doors[pos]) return false;
console.count(pos);
return true;
}

const times = 1000000;
for(let i = 0; i < times; i++) {
const win = threeDoors();
console.count(win);
}

0 comments on commit a3d96e7

Please sign in to comment.