You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
51 lines
720 B
51 lines
720 B
package main
|
|
|
|
import (
|
|
"flds"
|
|
"fmt"
|
|
"math/rand"
|
|
"time"
|
|
)
|
|
|
|
type (
|
|
|
|
S = struct {
|
|
A string
|
|
}
|
|
)
|
|
|
|
func Una () S {
|
|
fmt.Println("Es llamado ")
|
|
return S { A : "Un valiue" }
|
|
}
|
|
|
|
func randomInt(min, max int) int {
|
|
rand.Seed(time.Now().UnixNano()) // Semilla para generar números aleatorios únicos
|
|
return rand.Intn(max-min+1) + min
|
|
}
|
|
|
|
|
|
func main() {
|
|
|
|
|
|
|
|
doInt := *flds.NewDOFieldInt("Mi",func()int{ return randomInt(1, 100000) })
|
|
doInt2 := doInt
|
|
|
|
v := doInt.Native()
|
|
v1 := doInt2.Native()
|
|
fmt.Printf("Kind %s\n",doInt.Kind().Name())
|
|
fmt.Printf("Valor %d\n",v)
|
|
for i:=0; i<100000; i++ {
|
|
v1 = doInt2.Native()
|
|
if v != v1 {
|
|
fmt.Println("ERROR ES DIFE>RENTE")
|
|
break
|
|
}
|
|
}
|
|
fmt.Printf("Valor %d\n",v1)
|
|
|
|
|
|
|
|
}
|