Coder Social home page Coder Social logo

gen-populus's Introduction

gen-populus

drawing

Gen-Populus is a random population data generator.

Data Format

   ID        --> Snowflake id generator [github.com/3n0ugh/snowflake]
   Name      --> Randomly chosen from name CSV file 
   Lastname  --> Randomly chosen from lastname CSV file
   Email     --> Name + Lastname + Last four number of ID + @3n0ugh.com
   Age       --> Generate random between 0 and 111
   Birthdate --> Random day and month + (Current year - age)
   Gender    --> It depends on which file the name is taken from.

Requirements

Usage

  • You can define the output file, first name file, last name file, and population size.
  • However, the ratios such as the number of children-young-old or male-female numbers are defined randomly. (Check the config file to find out how. )
// Open or if not exists create output file
file, _ := os.OpenFile("data.csv", os.O_CREATE|os.O_WRONLY, 0644)
cfg, _ := config.NewConfig(
	1e7,                               // population size: 10_000_000
	"./internal/data/female_name.csv", // female_name's file
	"./internal/data/male_name.csv",   // male_name's file
	"./internal/data/lastname.csv",    // lastname's file
	file)                              // output file
  • Then, pass config as a parameter to the generator function.
err = generator.Generate(cfg)
if err != nil {
	log.Println(err)
}
  • You can check the main file for example.

Benchmark

  • Run benchmark (with 10 million population size):
$ go test -bench=. -count=10  ./pkg/generator   

gen-populus's People

Contributors

3n0ugh avatar

Stargazers

 avatar

Watchers

 avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.