using System.Collections.Generic; using System.Linq; using UnityEngine; public class fuck_googlemath : MonoBehaviour { public int familyCnt = 1000000; private List<Children> family = new List<Children>(); void Start() { for (int f = 0; f < familyCnt; f++) { bool produce = true; var fam = new Children(); while (produce) { var rnd = Random.Range(0, 1f); if (rnd > 0.5) fam.boy++; else fam.girl++; if (fam.boy > 0) produce = false; } family.Add(fam); } float boyCnt = family.Sum(x => x.boy); float girlCnt = family.Sum(x => x.girl); print($"boy = {boyCnt} : girl = {girlCnt} ? {boyCnt / girlCnt}"); } } public class Children { public int boy; public int girl; }


๊ฑ ๋Œ๋ ค๋ด...


๊ณ„์‚ฐ์€ ์ฝคํ“จํƒ€๊ฐ€ ํ•˜๋Š”๊ฒŒ ๋งž๋‹ค....