My cheat sheet of array related functions. I’ll add more along the way when I use more of it.
Declaring Array
int[] ia = new int[3];
ia[0] = 9;
ia[1] = 8;
ia[2] = 7;
Char Array To String
char[] ca = {'a', 'p', 'p', 'l', 'e'};
String s = String.valueOf(ca);
System.out.println(s);
Array Sort
String[] fruits = {"pear"…
Items/ingredients
- Eggs
- Pots
- Stove
- Ice
- Water
Instructions
- Leave eggs in fridge overnight.
- Boil a pot of water. Once boiled, lower the flame to the smallest possible where you could still see small bubbles bubbling.
- Put eggs into pot slowly with spoon so that you don’t crack the egg shell.
- Let it cook for 7 minutes.
- While waiting, prepare a pot or big bowl of ice water with ice in it.
- Once 7 minute reached. Quickly move the eggs into the ice water and leave it in there for 1 minute.
- Remove the eggs and de-shell.
Golang random number generator needs a seed in order to really generate a random number. Without seed, if you ran the randomizer 10 times now and 10 times a minute later, you will notice that the numbers produced are the same.
package mainimport (
"fmt"
"time"
"math/rand"
)func main() {
for z:=0; z<9; z++ {
rand.Seed(time.Now().UTC().UnixNano())
fmt.Println("My favorite number is", rand.Intn(10))
}
}