• Stars
    star
    110
  • Rank 316,770 (Top 7 %)
  • Language
    Go
  • License
    Apache License 2.0
  • Created over 10 years ago
  • Updated about 2 years ago

Reviews

There are no reviews yet. Be the first to send feedback to the community and the maintainers!

Repository Details

A pseudo-random number generator wriiten in Golang

go_rng

Build Status CircleCI GitHub stars GitHub license GoDoc

A pseudo-random number generator written in Golang v1.3 伪随机数生成器库的Go语言实现

Features

Inspired by:

Supported Distributions and Functionalities:

均匀分布 Uniform Distribution
伯努利分布 Bernoulli Distribution
卡方分布 Chi-Squared Distribution
Gamma分布 Gamma Distribution
Beta分布 Beta Distribution
费舍尔F分布 Fisher's F Distribution
柯西分布 Cauchy Distribution
韦伯分布 Weibull Distribution
Pareto分布 Pareto Distribution
对数高斯分布 Log Normal Distribution
指数分布 Exponential Distribution
学生T分布 Student's t-Distribution
二项分布 Binomial Distribution
泊松分布 Poisson Distribution
几何分布 Geometric Distribution
高斯分布 Gaussian Distribution
逻辑分布 Logistic Distribution
狄利克雷分布 Dirichlet Distribution

Requirements

  • Golang 1.7 and above

Installation

go get -u -v github.com/leesper/go_rng

Usage

func TestGaussianGenerator(t *testing.T) {
	fmt.Println("=====Testing for GaussianGenerator begin=====")
	grng := NewGaussianGenerator(time.Now().UnixNano())
	fmt.Println("Gaussian(5.0, 2.0): ")
	hist := map[int64]int{}
	for i := 0; i < 10000; i++ {
		hist[int64(grng.Gaussian(5.0, 2.0))]++
	}

	keys := []int64{}
	for k := range hist {
		keys = append(keys, k)
	}
	SortInt64Slice(keys)

	for _, key := range keys {
		fmt.Printf("%d:\t%s\n", key, strings.Repeat("*", hist[key]/200))
	}

	fmt.Println("=====Testing for GaussianGenerator end=====")
	fmt.Println()
}

output:

=====Testing for GaussianGenerator begin=====
Gaussian(5.0, 2.0):
-2:
-1:
0:	*
1:	**
2:	****
3:	*******
4:	*********
5:	*********
6:	*******
7:	****
8:	**
9:
10:
11:
12:
=====Testing for GaussianGenerator end=====

Authors and acknowledgment

Contributing

Pull requests are welcome. For major changes, please open an issue first to discuss what you would like to change. Please make sure to update tests as appropriate.

More Repositories

1

tao

Asynchronous TCP framework written in golang
Go
655
star
2

couchdb-golang

Golang library for working with CouchDB 2.x
Go
52
star
3

ProgrammersLevelUp

用20年时间跟着皓叔刷“程序员练级攻略”
42
star
4

holmes

Golang logging package
Go
26
star
5

goac

An Aho-Corasick string matching lib implemented in Golang
Go
12
star
6

become-data-analyst

My solutions for projects in Udacity DAND
HTML
10
star
7

become-frontend-developer

My solutions for projects in Udacity FEND
JavaScript
8
star
8

gopay

Golang SDK for Wxpay and Alipay
Go
6
star
9

Programming-in-Go

My Solutions to the exercises in book "Programming in Go" by Mr. Mark Summerfield
Go
5
star
10

alGo

My solutions to the exercises of "ALgorithms 4ed" based on Go programming language
Go
3
star
11

algorithms_4ed

My Solutions to the exercises in book "Algorithms 4ed" by Prof Robert Sedgewick and Prof Kevin Wayne
Java
3
star
12

become-react-developer

My solutions for projects in Udacity RDND
JavaScript
3
star
13

become-business-analyst

My Solutions to Udacity Business Analyst Nanodegree
Python
2
star
14

pureql

A GraphQL Web Framework
Go
2
star
15

llrb

A Left-Leaning Red-Black Tree written in Golang
Go
2
star
16

baidupush-golang

A Golang SDK for Baidu Cloud Push Service
Go
2
star
17

ProgrammingBasics

清华大学《程序设计基础》
Makefile
2
star
18

become-design-sprinter

My solutions for projects in Udacity DSFND
2
star
19

springbucks

Learn Spring from Geektime
Java
1
star
20

chan11

a golang-like channel implemented based on C++11
C++
1
star
21

readme

My README.md template file
1
star
22

cpp_primer5_solution

My solutions to the book "C++ Primer 5th"
C++
1
star
23

mlia

source code of book "Machine Learning in Action"
HTML
1
star
24

gonzh

Tiny library for converting numbers to Chinese strings
Go
1
star
25

become-data-engineer

Udacity Data Engineer Nanodegree (DEND)
Jupyter Notebook
1
star
26

become-deeplearning-engineer

My solutions for projects in Udacity DLND
Jupyter Notebook
1
star
27

pure

A small-yet-beautiful pure JSON API web framework
Go
1
star
28

become-machinelearning-engineer

My solutions for projects in Udacity MLND
Jupyter Notebook
1
star
29

become-aipnd-learner

my solution to Artificial Intelligence Programming Nanodegree
Jupyter Notebook
1
star
30

become-software-engineer

A detailed notes for the Book "Build To Win: Effective Software Engineering"
1
star
31

data-scientist-in-action

comprehensive projects for data engineering and analysis
Shell
1
star