r/computerscience • u/ChickenFeline0 • May 24 '25
General One CS class, and now I'm addicted
I have taken a single college course on C++, and this is what it has brought me to. I saw a post about the birthday problem (if you don't know, it's a quick Google), and thought, "I bet I can write a program to test this with a pretty large sample size". Now here I am 1.5 hours later, with a program that tests the birthday problem with a range of group sizes from 1 to 100. It turns out it's true, at 23 people, there is a 50% chance of a shared birthday.
460
Upvotes


10
u/bokmann May 24 '25
I volunteer to TA a few high school computer science classes.
After a few months of coding, they write a program that will find the greatest common denominator between two humbers after the class collectively decides on a few different ways to do it. After they are done, i poont out “that is the first time you wrote a program to ask the computer a question you yourself don’t know the answer to”.
That moment hooks a lot of them. Good job, op, for self-motivating yourself to do the same thing. Feed that beast and you’ll go far.
By, the way, you just independently re-invented the Monte-Carlo method. If you could time travel back to 1945, that technique might be named the ChickenFeline Method.
Go read the wikipedia entry on it.
2
u/Such_Arugula4536 May 24 '25
which OS is that? it looks similar to windows but after looking at its other feature, it looks different.
88
u/FrosteeSwurl May 24 '25
If your randint method is supposed to be generating a number between x and y that is incorrect. That is generating a number between x and x+y
12
u/Alternative_Path5848 May 24 '25
Stay addicted.
8
u/ShotSquare9099 May 24 '25
Fantastic
8
u/Interesting-Ad-238 May 24 '25
Love your work bro, keep it up.
2
u/ChickenFeline0 May 24 '25
the code, for those who might want it: https://codefile.io/f/HeMQEKMgVT
1
u/Big_Badger5032 May 24 '25
What’s the IDE and distribution you are using?
1
u/oofy-gang May 24 '25
Are vowels getting expensive?
1
u/Embarrassed-Jellys May 24 '25
gentoo
1
u/DigitalJedi850 May 24 '25
Ay so… congrats man, welcome to the party… I looked at your output before your code, and … I wanna in the nicest way, because I’m actually happy for you, suggest that you name your variables better. Please.
1
u/sir-fisticuffs May 25 '25
Woah, Kate is looking good these days.
1
u/GunPointer May 27 '25
What is your editor?
9
u/fomq May 24 '25
Great. One piece of advice: don't use AI. If it was easy to learn, no one is going to pay you for that skill. It scares me how many engineers I see coming out of school now who can't do anything without AI. Your brain is a muscle and it needs to be exercised in order for you to learn. Cheers.
2
u/FrequentTown3 May 24 '25
Just a tip for more potentially skilled people here,
https://codeforces.com/blog/entry/61587
For a more "random" function.
2
u/yadav1aryan May 24 '25
One of us! One of us!
1
u/elite-data May 24 '25
I recently watched this video by Veritasium, and I had to write a program to verify that the paradoxical 31% result is actually true.
1
u/[deleted] May 24 '25
When I started programming i started with this too birthday problem 😄
1
u/TehMephs May 24 '25
Welcome to the last day of the first day of your life
1
u/Epsilon1299 May 25 '25
This is what happened to me with my first C course in high school. One semester and a great teacher later and I was making tons of random little projects for fun. Years later and I’m still making random projects for fun xP
Best advice I have to give is just keep doing that! Find algorithms or tools or whatever that you wanna try to build or improve on and just go for it. Learn what you need along the way and let the things you’re interested in making guide you down what you need to learn. There’s so much in CS that you gotta narrow your view and start somewhere xP
1
u/sinisoul May 25 '25
Cool! I hope you continue working at it. Learning how to program is a road worth traveling down.
A small unsolicited piece of advice - don't get discouraged if people say your code is poor as you're ramping up. Programmers are very obsessive about tiny mundane details.
1
u/Wet_Humpback May 25 '25
If you can take yourself out of the “I’m doing work” mindset and approach coding as a challenge of solving endless puzzles, the entire process becomes a hell of a lot of fun.
0
u/onetakemovie May 24 '25
One of us! :)
-5
u/[deleted] May 24 '25
who's gonna tell him that he won't find a job in the future?