npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2024 – Pkg Stats / Ryan Hefner

fakedatagen

v1.1.9

Published

根据配置文件生成数据

Downloads

8

Readme

命令行使用说明

  • 使用npm install fakedatagen安装到局部模块的使用方式
//在局部模块安装目录下运行
npx fakedatagen		//运行命令行程序
npx fakedatagen	-h	//获取帮助信息
npm update		//更新程序
npm link		//在全局路径下添加fakedatagen,运行命令时可类似全局安装
npm unlink fakedatagen -g				//移除fakedatagen全局命令
  • 使用npm install fakedatagen -g安装到全局模块的使用方式
//在任何目录下运行
fakedatagen		//运行命令程序
fakedatagen	-h	//获取帮助信息
npm update fakedatagen -g  //	更新程序

配置文件说明

示例文件

{
  "number": 100,

  "fix": 5,

  "seed": 0,
  "flipprob": 0.01,

  "para": [
    {
      "name": "p1",
      "type": "float",
      "function": {
        "type": "多项式",
        "para": [0.5, 50, 3, -2, 2, -0.3],
        "range": [0, 2]
      }
    },
    {
      "name": "p2",
      "type": "float",
      "function": {
        "type": "sin",
        "para": [1, 0],
        "range": [0, 6.28]
      }
    },
    {
      "name": "n1",
      "type": "bool"
    },
    {
      "name": "n2",
      "type": "bool"
    }
  ]
}
  • number:序列长度

  • fix:设置float小数点位数

  • seed:在其他配置不变的情况下修改seed可以生成不同序列(目前只针对bool数据有效)

  • flipprob:bool序列发反转概率

  • para:参数列表

    • name:参数名

    • type:参数类型

      • float
      • bool
    • function:float序列生成所应用的采样函数

      • type:函数类别

        • cos
        • sin
        • 折线
        • 多项式
      • para:函数参数

        • 多项式:[k, a0, a1, a2 ,a3, a4]

          $k*(a1Math.sin(x)+a2Math.cos(x)+a3x+a4Math.pow(x,2)+a0)$

        • sin:[k, a0]

          $k*Math.sin(x)+a0$

      • range:数据采样范围

模块使用示例程序

const path = require('path')
const fakedatagen = require('./fakedatagen')

//第一个参数为配置文件完整路径,第二个参数为输出文件完整路径
fakedatagen(path.join(__dirname, 'conf.json'),path.join(__dirname,'result.txt'))