Search Options

Results per page
Sort
Preferred Languages
Advance

Results 1 - 3 of 3 for newPcgRand (0.1 sec)

  1. src/internal/fuzz/mutator_test.go

    			buf := make([]byte, size)
    			b.ResetTimer()
    
    			for i := 0; i < b.N; i++ {
    				// resize buffer to the correct shape and reset the PCG
    				buf = buf[0:size]
    				m.r = newPcgRand()
    				m.mutate([]any{buf}, workerSharedMemSize)
    			}
    		})
    	}
    }
    
    func BenchmarkMutatorString(b *testing.B) {
    	origEnv := os.Getenv("GODEBUG")
    	defer func() { os.Setenv("GODEBUG", origEnv) }()
    Registered: Wed Jun 12 16:32:35 UTC 2024
    - Last Modified: Mon Dec 13 18:45:54 UTC 2021
    - 2.3K bytes
    - Viewed (0)
  2. src/internal/fuzz/pcg.go

    			seed, err := strconv.Atoi(strings.TrimPrefix(f, "fuzzseed="))
    			if err != nil {
    				panic("malformed fuzzseed")
    			}
    			return &seed
    		}
    	}
    	return nil
    }
    
    // newPcgRand generates a new, seeded Rand, ready for use.
    func newPcgRand() *pcgRand {
    	r := new(pcgRand)
    	now := uint64(time.Now().UnixNano())
    	if seed := godebugSeed(); seed != nil {
    		now = uint64(*seed)
    	}
    	inc := globalInc.Add(1)
    	r.state = now
    Registered: Wed Jun 12 16:32:35 UTC 2024
    - Last Modified: Wed May 08 19:28:14 UTC 2024
    - 3.3K bytes
    - Viewed (0)
  3. src/internal/fuzz/mutator.go

    	"fmt"
    	"math"
    	"unsafe"
    )
    
    type mutator struct {
    	r       mutatorRand
    	scratch []byte // scratch slice to avoid additional allocations
    }
    
    func newMutator() *mutator {
    	return &mutator{r: newPcgRand()}
    }
    
    func (m *mutator) rand(n int) int {
    	return m.r.intn(n)
    }
    
    func (m *mutator) randByteOrder() binary.ByteOrder {
    	if m.r.bool() {
    		return binary.LittleEndian
    	}
    	return binary.BigEndian
    }
    Registered: Wed Jun 12 16:32:35 UTC 2024
    - Last Modified: Mon Sep 18 20:01:34 UTC 2023
    - 6.6K bytes
    - Viewed (0)
Back to top