pixled-lib  1.0
pixled/random/uniform.cpp

A pixled::random::UniformDistribution usage example.

random_uniform_t.gif random_uniform_xy_t.gif random_uniform_xy_t_hue.gif
RandomT RandomXYT RandoRandomXYT with hue
#include "pixled.h"
#include "pixled/gif_output.h"
int main(int argc, char** argv) {
pixled::LedPanel panel(16, 16, pixled::LEFT_RIGHT_RIGHT_LEFT_FROM_BOTTOM);
pixled::GifOutput out(256, pixled::FIT_WIDTH, 20, panel);
{
// Random engine that only depends upon time.
// The value will be the same for every leds, and will change every 10
// frames.
// Uniform integer distribution between 30 and 200
// Animation
pixled::rgb color(random_red, 30, 30);
pixled::Runtime runtime(panel, out, color);
// Writes 100 frames to gif file
out.write(runtime, 100, "random_uniform_t.gif");
}
{
// Random engine that only depends upon time and space.
// The value will be different for every leds, and will change every 10
// frames.
// Uniform integer distribution between 30 and 200 (same as above)
// Animation
pixled::rgb color(random_red, 30, 30);
pixled::Runtime runtime(panel, out, color);
// Writes 100 frames to gif file
out.write(runtime, 100, "random_uniform_xy_t.gif");
}
{
// Same as above
// An uniformly distributed random float between 0 and 360
// Animation
pixled::hsb color(random_hue, 1.0, 1.0);
pixled::Runtime runtime(panel, out, color);
// Writes 100 frames to gif file
out.write(runtime, 100, "random_uniform_xy_t_hue.gif");
}
}
Definition: runtime.h:28
Definition: chroma.h:25
Definition: chroma.h:46
Definition: mapping.h:150
Definition: random.h:75
Definition: random.h:95
Definition: random.h:126
std::minstd_rand random_engine
Definition: random.h:13