muzea-demo / random-data Goto Github PK
View Code? Open in Web Editor NEW随机数据产生姬
Home Page: https://muzea-demo.github.io/random-data/
License: MIT License
随机数据产生姬
Home Page: https://muzea-demo.github.io/random-data/
License: MIT License
指定一个表达式来生成一个数据
这个类型引入了本地变量的概念,ref
、prev
、index
,在这里会成为局部的保留字
语法
constraint g generator initValue expression
initValue
初始值 第一次取值的时候仍然会用 expression
去求一次值,也就是说,initValue
是 ref[0]
,第一次输出的值是 ref[1]
expression
一个合法的、不换行的 js_Expression
它需要返回一个值例如
constraint g generator 0 prev+index
显然这个类型我们需要引用一些特殊的信息,比如当前处在 列表
的第几个,之前的值是什么样子的,所以需要在里面占用掉一些变量的名字。
但是这几个变量只有在这个约束求值的时候才会存在,所以叫做局部的保留字。
你仍然可以使用 index
作为一个约束的变量名,这不会冲突,只是在 generator
约束的求值中无法访问这个变量。
repeat
语句中的不重复性比如sql测试数据
constraint 姓 set 赵 钱 孙 李
constraint 名 set 一 二 三 四
constraint value int 10 1000
constraint status int 0 2
repeat 10 INSERT INTO list (name, value, status) VALUES ("${姓}${名}", ${value}, ${status});
stringify
与 generator
将分开实现generator
的随机数取法抽象出来,允许在取随机数的时候由外部指定允许重写一个约束渲染时候的 template
语法
format varName template
比如
constraint w int 1 10
constraint g graph graphNum nodeNum edgeNum
format g ${value[0]} ${value[1]} ${w}
这样可以实现有权图,目前这个语法主要用来扩展 graph
类型
这个信息会挂在到约束上面
因为 stringify
的时候是没有 format
信息的,所以这里
shuffle
) 那么多 store
的设计会有问题,需要修改rawTemplate
rawValue
graph
来说,是求完所有的边再取 format
计算,还是一条边算完 format
再算下一条边A declarative, efficient, and flexible JavaScript library for building user interfaces.
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google ❤️ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.