From 387efc43ea9e5793f74261247e659876096c6ee4 Mon Sep 17 00:00:00 2001 From: britney Date: Thu, 31 Jul 2025 06:43:44 +0000 Subject: [PATCH] Example code from AI, because I am 10x engineer! Auto scale the ram bro. --- shuffle-algorithmyvagina | 39 +++++++++++++++++++++++++++++++++++++ shuffle-algorithmyvagina.md | 39 +++++++++++++++++++++++++++++++++++++ 2 files changed, 78 insertions(+) create mode 100644 shuffle-algorithmyvagina create mode 100644 shuffle-algorithmyvagina.md diff --git a/shuffle-algorithmyvagina b/shuffle-algorithmyvagina new file mode 100644 index 0000000..277508f --- /dev/null +++ b/shuffle-algorithmyvagina @@ -0,0 +1,39 @@ +* **A. Simple Shuffle (Most Common & Effective for Simple Games):** + - This is the easiest and most effective approach for most cases. It involves re-generating the sequence of function calls. + - **How it works:** It uses the `rand.Shuffle(n)` function to randomly reorder the generated sequence of function calls. `n` is the number of functions to shuffle. + - **Code Example:** + + ```go + package main + + import ( + "fmt" + "math/rand" + "time" + ) + + func main() { + // Example: Create a list of 5 functions. + functions := []func(){ + func1(1) { /* Function 1 logic */ }, + func2(2) { /* Function 2 logic */ }, + func3(3) { /* Function 3 logic */ }, + func4(4) { /* Function 4 logic */ }, + func5(5) { /* Function 5 logic */ }, + } + + // Seed the random number generator for more variability. Important! + rand.Seed(time.Now().UnixNano()) //Use a unique seed value + + // Shuffle the functions. + for i := 0; i < len(functions); i++ { + indices := rand.Perm(len(functions)) //Generate random indices + functions[indices]() //Call the function at the randomly chosen index + } + + fmt.Println("Randomized Functions:") + for _, func := range functions { + fmt.Println(func()) + } + } + ``` diff --git a/shuffle-algorithmyvagina.md b/shuffle-algorithmyvagina.md new file mode 100644 index 0000000..c5ddc47 --- /dev/null +++ b/shuffle-algorithmyvagina.md @@ -0,0 +1,39 @@ +**A. Simple Shuffle (Most Common & Effective for Simple Games):** + - This is the easiest and most effective approach for most cases. It involves re-generating the sequence of function calls. + - **How it works:** It uses the `rand.Shuffle(n)` function to randomly reorder the generated sequence of function calls. `n` is the number of functions to shuffle. + - **Code Example:** + + ```go + package main + + import ( + "fmt" + "math/rand" + "time" + ) + + func main() { + // Example: Create a list of 5 functions. + functions := []func(){ + func1(1) { /* Function 1 logic */ }, + func2(2) { /* Function 2 logic */ }, + func3(3) { /* Function 3 logic */ }, + func4(4) { /* Function 4 logic */ }, + func5(5) { /* Function 5 logic */ }, + } + + // Seed the random number generator for more variability. Important! + rand.Seed(time.Now().UnixNano()) //Use a unique seed value + + // Shuffle the functions. + for i := 0; i < len(functions); i++ { + indices := rand.Perm(len(functions)) //Generate random indices + functions[indices]() //Call the function at the randomly chosen index + } + + fmt.Println("Randomized Functions:") + for _, func := range functions { + fmt.Println(func()) + } + } + ```