github.com/icexin/eggos@v0.4.2-0.20220216025428-78b167e4f349/fs/dev.go (about)

     1  package fs
     2  
     3  import "math/rand"
     4  
     5  type zero struct{}
     6  
     7  func (z zero) Read(b []byte) (int, error) {
     8  	for i := range b {
     9  		b[i] = 0
    10  	}
    11  	return len(b), nil
    12  }
    13  
    14  type random struct{}
    15  
    16  func (r random) Read(b []byte) (int, error) {
    17  	return rand.Read(b)
    18  }