Best Mock code snippet using source.Sixteen
murmur_test.go
Source:murmur_test.go
1/*2Copyright (c) 2015, RetailNext, Inc.3All rights reserved.4Redistribution and use in source and binary forms, with or without modification, are permitted provided that the following conditions are met:51. Redistributions of source code must retain the above copyright notice, this list of conditions and the following disclaimer.62. Redistributions in binary form must reproduce the above copyright notice, this list of conditions and the following disclaimer in the documentation and/or other materials provided with the distribution.73. Neither the name of the copyright holder nor the names of its contributors may be used to endorse or promote products derived from this software without specific prior written permission.8THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.9*/10package hll11import (12 "crypto/sha1"13 "encoding/binary"14 "strings"15 "testing"16)17func TestMurmur(t *testing.T) {18 sixteen := "exactly-16-bytes"19 cases := []struct {20 input []byte21 expected uint6422 }{23 {24 []byte("\x00"),25 binary.LittleEndian.Uint64([]byte{181, 92, 255, 110, 229, 171, 16, 70, 131}),26 },27 {28 []byte("\xFF"),29 binary.LittleEndian.Uint64([]byte{236, 144, 226, 164, 120, 55, 218, 71, 46}),30 },31 {32 []byte("superlogical-skeleton"),33 binary.LittleEndian.Uint64([]byte{18, 139, 164, 68, 109, 45, 88, 40, 180}),34 },35 {36 []byte(strings.Repeat("separator-quizzingly", 100)),37 binary.LittleEndian.Uint64([]byte{75, 88, 136, 147, 185, 104, 20, 147, 230}),38 },39 {40 []byte("\x00"),41 binary.LittleEndian.Uint64([]byte{181, 92, 255, 110, 229, 171, 16, 70, 131}),42 },43 {44 []byte("\x00\x01"),45 binary.LittleEndian.Uint64([]byte{76, 38, 171, 141, 197, 245, 179, 124, 68}),46 },47 {48 []byte("\x00\x01\x02"),49 binary.LittleEndian.Uint64([]byte{190, 230, 83, 239, 47, 161, 114, 184, 182}),50 },51 {52 []byte("\x00\x01\x02\x03"),53 binary.LittleEndian.Uint64([]byte{16, 175, 223, 13, 174, 148, 197, 225, 226}),54 },55 {56 []byte("\x00\x01\x02\x03\x04"),57 binary.LittleEndian.Uint64([]byte{54, 64, 249, 166, 212, 140, 238, 65, 246}),58 },59 {60 []byte("\x00\x01\x02\x03\x04\x05"),61 binary.LittleEndian.Uint64([]byte{60, 4, 245, 164, 187, 58, 152, 102, 160}),62 },63 {64 []byte("\x00\x01\x02\x03\x04\x05\x06"),65 binary.LittleEndian.Uint64([]byte{104, 13, 75, 202, 135, 105, 76, 189, 135}),66 },67 {68 []byte("\x00\x01\x02\x03\x04\x05\x06\x07"),69 binary.LittleEndian.Uint64([]byte{200, 47, 142, 214, 189, 225, 167, 71, 199}),70 },71 {72 []byte("\x00\x01\x02\x03\x04\x05\x06\x07\x08"),73 binary.LittleEndian.Uint64([]byte{50, 45, 129, 110, 15, 203, 180, 251, 185}),74 },75 {76 []byte("\x00\x01\x02\x03\x04\x05\x06\x07\x08\x09"),77 binary.LittleEndian.Uint64([]byte{99, 228, 88, 158, 232, 37, 202, 207, 118}),78 },79 {80 []byte("\x00\x01\x02\x03\x04\x05\x06\x07\x08\x09\x0A"),81 binary.LittleEndian.Uint64([]byte{136, 79, 86, 199, 71, 79, 123, 197, 176}),82 },83 {84 []byte("\x00\x01\x02\x03\x04\x05\x06\x07\x08\x09\x0A\x0B"),85 binary.LittleEndian.Uint64([]byte{202, 165, 18, 146, 230, 167, 93, 179, 70}),86 },87 {88 []byte("\x00\x01\x02\x03\x04\x05\x06\x07\x08\x09\x0A\x0B\x0C"),89 binary.LittleEndian.Uint64([]byte{194, 65, 95, 197, 242, 217, 82, 75, 252}),90 },91 {92 []byte("\x00\x01\x02\x03\x04\x05\x06\x07\x08\x09\x0A\x0B\x0C\x0D"),93 binary.LittleEndian.Uint64([]byte{100, 109, 144, 53, 238, 51, 169, 95, 223}),94 },95 {96 []byte("\x00\x01\x02\x03\x04\x05\x06\x07\x08\x09\x0A\x0B\x0C\x0D\x0E"),97 binary.LittleEndian.Uint64([]byte{233, 37, 73, 253, 152, 21, 35, 71, 233}),98 },99 {100 []byte("\x00\x01\x02\x03\x04\x05\x06\x07\x08\x09\x0A\x0B\x0C\x0D\x0E\x0F"),101 binary.LittleEndian.Uint64([]byte{48, 63, 144, 145, 181, 36, 73, 68, 69}),102 },103 {104 []byte(sixteen + "\x00"),105 binary.LittleEndian.Uint64([]byte{107, 80, 200, 85, 251, 132, 195, 106, 201}),106 },107 {108 []byte(sixteen + "\x00\x01"),109 binary.LittleEndian.Uint64([]byte{8, 163, 120, 155, 17, 116, 0, 239, 159}),110 },111 {112 []byte(sixteen + "\x00\x01\x02"),113 binary.LittleEndian.Uint64([]byte{205, 145, 14, 223, 61, 213, 142, 251, 3}),114 },115 {116 []byte(sixteen + "\x00\x01\x02\x03"),117 binary.LittleEndian.Uint64([]byte{165, 234, 67, 132, 62, 250, 205, 15, 107}),118 },119 {120 []byte(sixteen + "\x00\x01\x02\x03\x04"),121 binary.LittleEndian.Uint64([]byte{125, 248, 112, 82, 86, 0, 223, 50, 207}),122 },123 {124 []byte(sixteen + "\x00\x01\x02\x03\x04\x05"),125 binary.LittleEndian.Uint64([]byte{228, 222, 242, 88, 206, 209, 208, 221, 22}),126 },127 {128 []byte(sixteen + "\x00\x01\x02\x03\x04\x05\x06"),129 binary.LittleEndian.Uint64([]byte{156, 172, 230, 68, 108, 255, 208, 237, 21}),130 },131 {132 []byte(sixteen + "\x00\x01\x02\x03\x04\x05\x06\x07"),133 binary.LittleEndian.Uint64([]byte{0, 154, 196, 254, 211, 207, 108, 26, 61}),134 },135 {136 []byte(sixteen + "\x00\x01\x02\x03\x04\x05\x06\x07\x08"),137 binary.LittleEndian.Uint64([]byte{227, 158, 95, 195, 12, 14, 8, 67, 92}),138 },139 {140 []byte(sixteen + "\x00\x01\x02\x03\x04\x05\x06\x07\x08\x09"),141 binary.LittleEndian.Uint64([]byte{63, 193, 84, 194, 216, 137, 100, 77, 231}),142 },143 {144 []byte(sixteen + "\x00\x01\x02\x03\x04\x05\x06\x07\x08\x09\x0A"),145 binary.LittleEndian.Uint64([]byte{100, 22, 13, 55, 181, 18, 218, 178, 164}),146 },147 {148 []byte(sixteen + "\x00\x01\x02\x03\x04\x05\x06\x07\x08\x09\x0A\x0B"),149 binary.LittleEndian.Uint64([]byte{164, 109, 195, 45, 7, 0, 15, 97, 174}),150 },151 {152 []byte(sixteen + "\x00\x01\x02\x03\x04\x05\x06\x07\x08\x09\x0A\x0B\x0C"),153 binary.LittleEndian.Uint64([]byte{113, 136, 95, 250, 81, 190, 207, 152, 61}),154 },155 {156 []byte(sixteen + "\x00\x01\x02\x03\x04\x05\x06\x07\x08\x09\x0A\x0B\x0C\x0D"),157 binary.LittleEndian.Uint64([]byte{191, 140, 212, 107, 211, 254, 58, 190, 108}),158 },159 {160 []byte(sixteen + "\x00\x01\x02\x03\x04\x05\x06\x07\x08\x09\x0A\x0B\x0C\x0D\x0E"),161 binary.LittleEndian.Uint64([]byte{64, 129, 187, 169, 124, 88, 127, 169, 180}),162 },163 {164 []byte(sixteen + "\x00\x01\x02\x03\x04\x05\x06\x07\x08\x09\x0A\x0B\x0C\x0D\x0E\x0F"),165 binary.LittleEndian.Uint64([]byte{162, 30, 109, 8, 38, 209, 12, 244, 183}),166 },167 }168 for i, c := range cases {169 if sum := MurmurSum64(c.input); sum != c.expected {170 t.Errorf("#%d: got %d, expected %d", i, sum, c.expected)171 }172 }173 bigEndian = !bigEndian174 defer func() { bigEndian = !bigEndian }()175 for i, c := range cases {176 if sum := MurmurSum64(c.input); sum != c.expected {177 t.Errorf("#%d: got %d, expected %d", i, sum, c.expected)178 }179 }180}181func BenchmarkMurmurSmall(b *testing.B) {182 data := []byte("zealotist")183 for i := 0; i < b.N; i++ {184 _ = MurmurSum64(data)185 }186}187func BenchmarkMurmurMedium(b *testing.B) {188 data := []byte("zealotist-adventure crammer-empyromancy")189 for i := 0; i < b.N; i++ {190 _ = MurmurSum64(data)191 }192}193func BenchmarkMurmurLarge(b *testing.B) {194 data := []byte(strings.Repeat("ergogram-artificer", 100))195 for i := 0; i < b.N; i++ {196 _ = MurmurSum64(data)197 }198}199func BenchmarkSHA1(b *testing.B) {200 h := sha1.New()201 data := []byte("zealotist")202 var tmp []byte203 for i := 0; i < b.N; i++ {204 h.Write(data)205 tmp = h.Sum(tmp[0:0])206 _ = binary.BigEndian.Uint64(tmp)207 h.Reset()208 }209}...
reporting_server_run_info_test.go
Source:reporting_server_run_info_test.go
...103 }104 })105 }106}107func TestReportingServerRunInfoLoadSixteenDaysOfData(t *testing.T) {108 //clear out the docs109 defer suite.DeleteAllDocuments()110 backend := &relaxting.ES2Backend{ESUrl: opensearchUrl}111 server := reportingServer.New(backend)112 lis := bufconn.Listen(1024 * 1024)113 s := grpc.NewServer()114 reporting.RegisterReportingServiceServer(s, server)115 go func() {116 if err := s.Serve(lis); err != nil {117 log.Fatalf("Server exited with error: %v", err)118 }119 }()120 dialer := func(string, time.Duration) (net.Conn, error) { return lis.Dial() }121 conn, err := grpc.DialContext(context.Background(), "bufnet", grpc.WithDialer(dialer), grpc.WithInsecure())122 defer conn.Close()123 require.NoError(t, err)124 now := time.Now().UTC().Truncate(60 * time.Second)125 reports := []*relaxting.ESInSpecReport{}126 summaries := []*relaxting.ESInSpecSummary{}127 seventeenDaysAgo := now.Add(time.Duration(-24*17) * time.Hour)128 //put in 2 reports and summaries every day for the past 16 days starting with yesterday129 for i := 1; i <= 16; i++ {130 dayOfReport := seventeenDaysAgo.Add(time.Duration(24*i) * time.Hour)131 reports = append(reports,132 &relaxting.ESInSpecReport{133 NodeID: newUUID(),134 EndTime: dayOfReport,135 })136 reports = append(reports,137 &relaxting.ESInSpecReport{138 NodeID: newUUID(),139 EndTime: dayOfReport,140 })141 summaries = append(summaries,142 &relaxting.ESInSpecSummary{143 NodeID: newUUID(),144 EndTime: dayOfReport,145 })146 summaries = append(summaries,147 &relaxting.ESInSpecSummary{148 NodeID: newUUID(),149 EndTime: dayOfReport,150 })151 }152 reportIds, err := suite.InsertInspecReports(reports)153 require.NoError(t, err)154 _, err = suite.InsertInspecSummaries(summaries)155 require.NoError(t, err)156 _, err = suite.InsertComplianceRunInfos(reports)157 require.NoError(t, err)158 rerunReports := []*relaxting.ESInSpecReport{}159 rerunSummaries := []*relaxting.ESInSpecSummary{}160 //rerun one of the two run nodes for each day on days 3, 4 and 5 and rerun on the same days, just a minute later161 //we do two nodes a day above so162 //day 3 runs occupy index 4 and 5163 //day 4 runs occupy index 6 and 7164 //day 5 runs occupy index 8 and 9165 for i := 4; i < 10; i += 2 {166 dayOfReport := reports[i].EndTime.Add(time.Duration(1) * time.Minute)167 rerunReports = append(rerunReports,168 &relaxting.ESInSpecReport{169 NodeID: reports[i].NodeID,170 EndTime: dayOfReport,171 })172 rerunSummaries = append(rerunSummaries,173 &relaxting.ESInSpecSummary{174 NodeID: reports[i].NodeID,175 EndTime: dayOfReport,176 })177 }178 reportIds, err = suite.InsertInspecReports(rerunReports)179 require.NoError(t, err)180 summaryIds, err := suite.InsertInspecSummaries(rerunSummaries)181 require.NoError(t, err)182 runInfoIds, err := suite.InsertComplianceRunInfos(rerunReports)183 require.NoError(t, err)184 require.Len(t, reportIds, len(rerunReports))185 require.Len(t, summaryIds, len(rerunSummaries))186 require.Len(t, runInfoIds, len(rerunReports))187 rerunSecondReportFromSixteenDaysAgoToday := []*relaxting.ESInSpecReport{}188 rerunSummariesFromSixteenDaysAgoToday := []*relaxting.ESInSpecSummary{}189 //rerun the second report from 16 days ago.. rerun it today190 rerunSecondReportFromSixteenDaysAgoToday = append(rerunSecondReportFromSixteenDaysAgoToday,191 &relaxting.ESInSpecReport{192 NodeID: reports[1].NodeID,193 EndTime: now,194 })195 rerunSummariesFromSixteenDaysAgoToday = append(rerunSummariesFromSixteenDaysAgoToday,196 &relaxting.ESInSpecSummary{197 NodeID: reports[1].NodeID,198 EndTime: now,199 })200 reportIds, err = suite.InsertInspecReports(rerunSecondReportFromSixteenDaysAgoToday)201 require.NoError(t, err)202 summaryIds, err = suite.InsertInspecSummaries(rerunSummariesFromSixteenDaysAgoToday)203 require.NoError(t, err)204 runInfoIds, err = suite.InsertComplianceRunInfos(rerunSecondReportFromSixteenDaysAgoToday)205 require.NoError(t, err)206 require.Len(t, reportIds, len(rerunSecondReportFromSixteenDaysAgoToday))207 require.Len(t, summaryIds, len(rerunSummariesFromSixteenDaysAgoToday))208 require.Len(t, runInfoIds, len(rerunSecondReportFromSixteenDaysAgoToday))209}...
node_run_info_test.go
Source:node_run_info_test.go
...10 "github.com/chef/automate/components/ingest-service/backend/elastic/mappings"11 "github.com/stretchr/testify/assert"12 "github.com/stretchr/testify/require"13)14func TestNodeRunInfoLoadSixteenDaysOfData(t *testing.T) {15 //clear out the docs16 suite.DeleteAllDocuments()17 now := time.Now().UTC().Truncate(60 * time.Second)18 nodes := []iBackend.Node{}19 runs := []iBackend.Run{}20 seventeenDaysAgo := now.Add(time.Duration(-24*17) * time.Hour)21 //put in 2 nodes and runs every day for the past 16 days starting with yesterday22 for i := 1; i <= 16; i++ {23 dayOfReport := seventeenDaysAgo.Add(time.Duration(24*i) * time.Hour)24 uid := newUUID()25 nodes = append(nodes,26 iBackend.Node{27 Exists: true,28 NodeInfo: iBackend.NodeInfo{29 EntityUuid: uid,30 },31 })32 runs = append(runs,33 newIngestRun(newUUID(), "success",34 dayOfReport.Add(-1*time.Minute).Format(time.RFC3339),35 dayOfReport.Format(time.RFC3339)),36 )37 uid = newUUID()38 nodes = append(nodes,39 iBackend.Node{40 Exists: true,41 NodeInfo: iBackend.NodeInfo{42 EntityUuid: newUUID(),43 },44 })45 runs = append(runs,46 newIngestRun(newUUID(), "success",47 dayOfReport.Add(-1*time.Minute).Format(time.RFC3339),48 dayOfReport.Format(time.RFC3339)),49 )50 }51 suite.IngestNodes(nodes)52 suite.IngestRuns(runs)53 suite.IngestNodeRunDateInfo(runs)54 rurunRuns := []iBackend.Run{}55 //rerun one of the two run nodes for each day on days 3, 4 and 5 and rerun on the same days, just a minute later56 //we do two nodes a day above so57 //day 3 runs occupy index 4 and 558 //day 4 runs occupy index 6 and 759 //day 5 runs occupy index 8 and 960 for i := 4; i < 10; i += 2 {61 dayOfReport := runs[i].EndTime.Add(time.Duration(1) * time.Minute)62 rurunRuns = append(rurunRuns,63 newIngestRun(runs[i].EntityUuid, "success",64 dayOfReport.Add(-1*time.Minute).Format(time.RFC3339),65 dayOfReport.Format(time.RFC3339)),66 )67 }68 suite.IngestRuns(rurunRuns)69 suite.IngestNodeRunDateInfo(rurunRuns)70 rerunSecondReportFromSixteenDaysAgoToday := []iBackend.Run{}71 //rerun the second report from 16 days ago.. rerun it today72 rerunSecondReportFromSixteenDaysAgoToday = append(rerunSecondReportFromSixteenDaysAgoToday,73 newIngestRun(runs[1].EntityUuid, "success",74 now.Add(-1*time.Minute).Format(time.RFC3339),75 now.Format(time.RFC3339)),76 )77 suite.IngestRuns(rerunSecondReportFromSixteenDaysAgoToday)78 suite.IngestNodeRunDateInfo(rerunSecondReportFromSixteenDaysAgoToday)79}80func TestNodeRunInfoDateTime(t *testing.T) {81 nodeIds := []string{newUUID(), newUUID()}82 now := time.Now().UTC().Truncate(60 * time.Second)83 then := now.Add(time.Duration(-1) * time.Minute)84 nodes := []iBackend.Node{85 {86 Exists: true,87 NodeInfo: iBackend.NodeInfo{88 EntityUuid: nodeIds[0],89 },90 },91 {92 Exists: true,...
Sixteen
Using AI Code Generation
1import (2func main() {3 fmt.Println(rand.Intn(100))4 fmt.Println(rand.Intn(100))5 fmt.Println(rand.Float64())6 fmt.Println((rand.Float64() * 5) + 5)7 fmt.Println(rand.Intn(100))8 fmt.Println(rand.Intn(100))9 fmt.Println()10 s1 := rand.NewSource(42)11 r1 := rand.New(s1)12 fmt.Println(r1.Intn(100))13 fmt.Println(r1.Intn(100))14 fmt.Println(r1.Float64())15 fmt.Println((r1.Float64() * 5) + 5)16 fmt.Println(r1.Intn(100))17 fmt.Println(r1.Intn(100))18 fmt.Println()19 s2 := rand.NewSource(42)20 r2 := rand.New(s2)21 fmt.Println(r2.Intn(100))22 fmt.Println(r2.Intn(100))23 fmt.Println(r2.Float64())24 fmt.Println((r2.Float64() * 5) + 5)25 fmt.Println(r2.Intn(100))26 fmt.Println(r2.Intn(100))27}28import (29func main() {30 fmt.Println(rand.Intn(100))31 fmt.Println(rand.Intn(100))32 fmt.Println(rand.Float64())33 fmt.Println((rand.Float64() * 5) + 5)34 fmt.Println(rand.Intn(100))35 fmt.Println(rand.Intn(100))36 fmt.Println()37 s1 := rand.NewSource(42)38 r1 := rand.New(s1)39 fmt.Println(r1.Intn(100))40 fmt.Println(r1.Intn(100))41 fmt.Println(r1.Float64())42 fmt.Println((r1.Float64() * 5) + 5)43 fmt.Println(r1
Sixteen
Using AI Code Generation
1import "fmt"2func main() {3 fmt.Println(source.Sixteen())4}5import "fmt"6func main() {7 fmt.Println(source.Sixteen())8}9import "fmt"10func main() {11 fmt.Println(source.Sixteen())12}13import "fmt"14func main() {15 fmt.Println(source.Sixteen())16}17import "fmt"18func main() {19 fmt.Println(source.Sixteen())20}21import "fmt"22func main() {23 fmt.Println(source.Sixteen())24}25import "fmt"26func main() {27 fmt.Println(source.Sixteen())28}29import "fmt"30func main() {31 fmt.Println(source.Sixteen())32}33import "fmt"34func main() {35 fmt.Println(source.Sixteen())36}37import "fmt"38func main() {39 fmt.Println(source.Sixteen())40}41import "fmt"42func main() {43 fmt.Println(source.Sixteen())44}45import "fmt"46func main() {47 fmt.Println(source.Sixteen())48}49import "fmt"50func main() {51 fmt.Println(source.Sixteen())52}53import
Sixteen
Using AI Code Generation
1import (2func main() {3 fmt.Println("My favorite number is", rand.Intn(10))4}5import (6func main() {7 fmt.Println("My favorite number is", rand.Intn(10))8}9import (10func main() {11 fmt.Println("My favorite number is", rand.Intn(10))12}13import (14func main() {15 fmt.Println("My favorite number is", rand.Intn(10))16}17import (18func main() {19 fmt.Println("My favorite number is", rand.Intn(10))20}21import (22func main() {23 fmt.Println("My favorite number is", rand.Intn(10))24}25import (26func main() {27 fmt.Println("My favorite number is", rand.Intn(10))28}29import (30func main() {31 fmt.Println("My favorite number is", rand.Intn(10))32}33import (34func main() {35 fmt.Println("My favorite number is", rand.Intn(10))36}37import (38func main() {39 fmt.Println("My favorite number is", rand.Intn(10))40}
Sixteen
Using AI Code Generation
1import "fmt"2func main() {3 fmt.Println(source.Sixteen())4}5import "fmt"6func main() {7 fmt.Println(source.Sixteen())8}9func Sixteen() int {10}11import "testing"12func TestSixteen(t *testing.T) {13 if Sixteen() != 16 {14 t.Error("Sixteen() should return 16")15 }16}
Sixteen
Using AI Code Generation
1import (2type source struct {3}4func (s source) Sixteen() float64 {5}6func main() {7 fmt.Println(s.Sixteen())8}9import (10type source struct {11}12func (s *source) Sixteen() float64 {13}14func main() {15 fmt.Println(s.Sixteen())16}17import (18type source struct {19}20func (s *source) Sixteen() float64 {21}22func main() {23 fmt.Println(s.Sixteen())24}25main.main()26import (27type source struct {28}29func (s *source) Sixteen() float64 {30}31func main() {32 s = new(source)33 fmt.Println(s.Sixteen())34}35import (36type source struct {37}38func (s source) Sixteen() float64 {39}40func main() {41 s = new(source)42 fmt.Println(s.Sixteen())43}
Sixteen
Using AI Code Generation
1import (2func main() {3 fmt.Println(rand.Sixteen())4}5rand.Seed()6func Seed(seed int64)7import (8func main() {9 rand.Seed(42)10 fmt.Println(rand.Intn(100))11}12rand.Intn()13func Intn(n int) int14import (15func main() {16 rand.Seed(42)17 fmt.Println(rand.Intn(100))18}19rand.Float64()20func Float64() float6421import (22func main() {23 rand.Seed(42)24 fmt.Println(rand.Float64())25}
Learn to execute automation testing from scratch with LambdaTest Learning Hub. Right from setting up the prerequisites to run your first automation test, to following best practices and diving deeper into advanced test scenarios. LambdaTest Learning Hubs compile a list of step-by-step guides to help you be proficient with different test automation frameworks i.e. Selenium, Cypress, TestNG etc.
You could also refer to video tutorials over LambdaTest YouTube channel to get step by step demonstration from industry experts.
Get 100 minutes of automation test minutes FREE!!