Source

pdb / feed / feed.go

Full commit
package main

import (
	"syscall"
	"rand"
	"math"
)

func randFeed() {
	var i, feed uint8 = 0, 0
	for ;; {
		feed = 0
		for i = 0; i<8 ; i++ {
			if rand.Float() > 0.5 {
				feed += (1 << i)
			}
		}
		print(feed, "\n")
		syscall.Sleep(1000000000)
	}
}

func randFeed2() {
	var feed int = 0
	for ;; {
		feed = int(math.Ceil(rand.Float64() * 6.0))
		print(feed, "\n")
		syscall.Sleep(1000000000)
	}
}

func randFeed3() {
	var key int = 0
	var conftosig = map[int]int{
		1:41, 
		2:37, 
		3:24,
		4:21,
		5:42,
		6:40,
		7:26,
		8:32,
		9:1,
		10:2,
		11:3,
	}
	for ;; {
		key = int(math.Ceil(rand.Float64() * 11.0))
		print(conftosig[key], "\n")
		syscall.Sleep(2000000000)
	}
}

func feedInFive() {
	var i, feed uint8 = 0, 0
	for ;; {
		if i % 5 == 0 {
			feed = 5
		} else {
			feed = 1
		}
		print(feed, "\n")
		syscall.Sleep(1000000000)
		i++
	}
}

func binFeed() {
	feed, i := 0, 0
	for ;; {
		if i % 5 == 0 {
			if feed == 0 {
				feed = 1
			} else {
				feed = 0
			}
		}
		print(feed, "\n")
		syscall.Sleep(1000000000)
		i++
	}
}

func main() {
	randFeed3()
}