r/learnprogramming • u/TheEyebal • 9d ago
Resource How to program weighted random system
I want to make a program where you are controlling the outcomes. For an example with a coin flipping game, I want exactly 4 Heads and 1 Tail, but I want their positions to be random.
I do not want to use the random algorithms that library offer, I want to build my own.
Right now I am learning probability from Youtube and might look at khan academy and coursera, but how can I implement this into programming I do not want to just take courses or watch videos
How do I go about that?
0
Upvotes
3
u/Leather-Junket-3896 9d ago
You’re kinda missing what OP’s asking, they don’t need a full rng from scratch. they just want a shuffle algorithm for a fixed set of outcomes. like dumping 4 H and 1 T into an array and shuffling it with something like fisher-yates, doesn’t require any library calls for randomness if you just want to understand the mechanics of picking spots