Sample code for 30+ languages & platforms
Go

Generating Random Integer in Range

See more PRNG Examples

Demonstrates how to generate random integers in a specified range.

Chilkat Go Downloads

Go
    success := false

    // This example assumes the Chilkat API to have been previously unlocked.
    // See Global Unlock Sample for sample code.

    success = false

    fortuna := chilkat.NewPrng()

    // Generate random integers between 12 and 24 inclusive
    var i int
    for i = 0; i <= 100; i++ {
        fmt.Println(fortuna.RandomInt(12,24))
    }


    fortuna.DisposePrng()