heppu / seed-finder

Go tool that finds seed numbers for words

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Seed finder

Go tool that finds math/rand seed number for given word. Right now it's limited to [a-z] but can be easily modified for wider ascii range.

Usage

go get github.com/heppu/seed-finder
go install seed-finder
seed-finder -w hello

Example

package main

import (
    "fmt"
    "math/rand"
)

func main() {
    fmt.Println(getRandStr(-4611686018426513711, 5))
    fmt.Println(getRandStr(13143826, 5))
}

func getRandStr(seed int64, len int) (s string) {
    rand.Seed(seed)
    for i := 0; i < len; i++ {
        s += string(rand.Intn(26) + 97)
    }
    return
}

About

Go tool that finds seed numbers for words

License:MIT License


Languages

Language:Go 100.0%