Skip to content

Instantly share code, notes, and snippets.

View petrjahoda's full-sized avatar

Petr Jahoda petrjahoda

View GitHub Profile
@petrjahoda
petrjahoda / main.go
Created August 14, 2021 08:26
4. Changing the name with a method, passing a value
package main
import "fmt"
type Car struct {
name string
}
type Truck struct {
name string
@petrjahoda
petrjahoda / main.go
Created August 14, 2021 07:43
3. Changing the name with a function, by using a pointer
package main
import "fmt"
type Car struct {
name string
}
type Truck struct {
name string
@petrjahoda
petrjahoda / main.go
Created August 14, 2021 07:25
2. Changing the name with a function, by passing the value
package main
import "fmt"
type Car struct {
name string
}
type Truck struct {
name string
@petrjahoda
petrjahoda / main.go
Created August 14, 2021 07:20
1. The basics
package main
import "fmt"
type Car struct {
name string
}
type Truck struct {
name string
@petrjahoda
petrjahoda / main.go
Last active June 10, 2021 07:47
updated loop
for i := 0; i < numberOfSimulationas; i++ {
fmt.Print("Monte Carlo Simulation No. ")
fmt.Printf("%d\n", i+1)
if randomBadDay == rand.Intn(numberOfTrades-1)+1 {
profitPercentage = 100 - profitPercentage
fmt.Print("B")
}
sum := 0.0
profitsCount := 0
lossesCount := 0