Would you like to clone this notebook?

When you clone a notebook you are able to make changes without affecting the original notebook.

Cancel

A Quick Bite of Tastes

node v10.24.1
version: 1.0.1
endpointsharetweet
// 1. Define the variables we want to play with const { integer, record } = require('tastes@0.3.2') const hue = integer({ min: 0, max: 360 }) const poster = record({ fgHue: hue, bgHue: hue, headerPt: integer({ min: 20, max: 32 }), bodyPt: integer({ min: 12, max: 20 }), }) // 2. We can checkout the specific poster design at // `(0.4, 0.2, 0.75, 0)` in the sample space. console.log(poster([0.4, 0.2, 0.75, 0])) // 3. But that's too manual. Let's just ask for 30 random // sample poster designs. const { sampleRandom, take } = require('tastes@0.3.2') for (const s of take(30, sampleRandom(poster))) { console.log(s) } // 4. But random designs may not be the best examples. // Let's check out carefully selected "representative" // samples instead. const { sampleBatch } = require('tastes@0.3.2') // Use detail of order 3 for (const s of sampleBatch(poster, 3)) { // `console.log` is used in abscence of // a proper rendering function console.log(s) }
Loading…

no comments

    sign in to comment