Search Options

Results per page
Sort
Preferred Languages
Advance

Results 1 - 2 of 2 for Example_rand (0.15 sec)

  1. src/math/rand/example_test.go

    	}
    	fmt.Println("Magic 8-Ball says:", answers[rand.Intn(len(answers))])
    }
    
    // This example shows the use of each of the methods on a *Rand.
    // The use of the global functions is the same, without the receiver.
    func Example_rand() {
    	// Create and seed the generator.
    	// Typically a non-fixed seed should be used, such as time.Now().UnixNano().
    	// Using a fixed seed will produce the same output on every run.
    	r := rand.New(rand.NewSource(99))
    
    Registered: Wed Jun 12 16:32:35 UTC 2024
    - Last Modified: Wed Oct 26 16:24:57 UTC 2022
    - 4.2K bytes
    - Viewed (0)
  2. src/math/rand/v2/example_test.go

    	}
    	fmt.Println("Magic 8-Ball says:", answers[rand.IntN(len(answers))])
    }
    
    // This example shows the use of each of the methods on a *Rand.
    // The use of the global functions is the same, without the receiver.
    func Example_rand() {
    	// Create and seed the generator.
    	// Typically a non-fixed seed should be used, such as Uint64(), Uint64().
    	// Using a fixed seed will produce the same output on every run.
    	r := rand.New(rand.NewPCG(1, 2))
    
    Registered: Wed Jun 12 16:32:35 UTC 2024
    - Last Modified: Mon Oct 30 17:09:26 UTC 2023
    - 4.4K bytes
    - Viewed (0)
Back to top