This commit is contained in:
2020-07-31 19:37:30 +02:00
parent 9e97ab9592
commit 9ec6440dc7
5 changed files with 19 additions and 11 deletions

View File

@ -1,12 +1,13 @@
'use strict';
const faker = require ('faker');
const sn = require ('simplex-noise');
function create_log () {
function create_log (index, simplex) {
const data = {
num1: faker.random.number (),
num2: faker.random.number (),
num3: faker.random.number ()
num2: simplex.noise2D (index * 0.1, 0),
num3: simplex.noise2D (index * 0.1, 1000)
};
return {
app: faker.random.word (),
@ -18,9 +19,10 @@ function create_log () {
async function seed (knex) {
console.log ('creating seeds');
const simplex = (new sn);
const log = (Array (20))
.fill (() => null)
.map (() => create_log ());
.map ((a, index) => create_log (index, simplex));
await knex ('log')
.del ();