Member-only story
How To Use Rand.Seed and Rand.Shuffle() in Go
We all know life can be random.
Why not embrace randomness then?
Let’s see how we can use Go to simulate random behaviour.
Use Cases of Randomness
- Randomizing the order of items: If you’re creating a quiz application, for instance, you might want to randomize the order of questions or the order of answer choices for each question to prevent cheating or rote learning (Rote learning is a memorization technique based on repetition. The idea is that one will be able to quickly recall the meaning of the material the more one repeats it).
- Machine Learning: In machine learning, it’s common to shuffle your data before splitting it into training and test sets to ensure that your training set is representative of the whole data set.
- Games: Many games, such as card games or board games, need to shuffle decks or lists of items to ensure fair play and unpredictability.
- Load Balancing: In a distributed system, shuffling can help distribute the load evenly. For example, you can shuffle a list of servers and then assign each incoming request to a server in order.
- A/B Testing: If you’re conducting an A/B…