<commit_before>package core

import (
	"math"
	"math/rand"
)

// UniformRandom emits a uniform random between 0 and 1
func UniformRandom() Spec {
	return Spec{
		Name:    "uniform",
		Inputs:  []Pin{Pin{"trigger", ANY}},
		Outputs: []Pin{Pin{"draw", NUMBER}},
		Kernel: func(in, out, internal MessageMap, s Source, i chan Interrupt) Interrupt {
			out[0] = rand.Float64()
			return nil
		},
	}
}

// NormalRandom emits a normally distributed random number with the
// supplied mean and variance
func NormalRandom() Spec {
	return Spec{
		Name:    "normal",
		Inputs:  []Pin{Pin{"mean", NUMBER}, Pin{"variance", NUMBER}},
		Outputs: []Pin{Pin{"draw", NUMBER}},
		Kernel: func(in, out, internal MessageMap, s Source, i chan Interrupt) Interrupt {
			variance, ok := in[1].(float64)
			if !ok {
				out[0] = NewError("variance must be a number")
				return nil
			}
			mean, ok := in[0].(float64)
			if !ok {
				out[0] = NewError("mean must be a number")
				return nil
			}
			out[0] = rand.NormFloat64()*math.Sqrt(variance) + mean
			return nil
		},<commit_msg>uniform random number now pushes<commit_after>package core

import (
	"math"
	"math/rand"
)

// UniformRandom emits a uniform random between 0 and 1
func UniformRandom() Spec {
	return Spec{
		Name:    "uniform",
		Inputs:  []Pin{},
		Outputs: []Pin{Pin{"draw", NUMBER}},
		Kernel: func(in, out, internal MessageMap, s Source, i chan Interrupt) Interrupt {
			out[0] = rand.Float64()
			return nil
		},
	}
}

// NormalRandom emits a normally distributed random number with the
// supplied mean and variance
func NormalRandom() Spec {
	return Spec{
		Name:    "normal",
		Inputs:  []Pin{Pin{"mean", NUMBER}, Pin{"variance", NUMBER}},
		Outputs: []Pin{Pin{"draw", NUMBER}},
		Kernel: func(in, out, internal MessageMap, s Source, i chan Interrupt) Interrupt {
			variance, ok := in[1].(float64)
			if !ok {
				out[0] = NewError("variance must be a number")
				return nil
			}
			mean, ok := in[0].(float64)
			if !ok {
				out[0] = NewError("mean must be a number")
				return nil
			}
			out[0] = rand.NormFloat64()*math.Sqrt(variance) + mean
			return nil
		},
{'fraction_non_alphanumeric': 0.14561734213006597, 'fraction_numerical': 0.015080113100848256, 'mean_word_length': 3.5952380952380953, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 3, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '4351306', 'n_tokens_mistral': 838, 'n_tokens_neox': 718, 'n_words': 227}