summaryrefslogtreecommitdiff
path: root/src/til_args.h
diff options
context:
space:
mode:
authorVito Caputo <vcaputo@pengaru.com>2022-07-17 17:34:25 -0700
committerVito Caputo <vcaputo@pengaru.com>2022-07-18 01:05:58 -0700
commit209b11f99c801141b79802cd6c23a2b568286f75 (patch)
treeb8d03651c118bdbdcceb3ca1deca4696952d8afe /src/til_args.h
parentb699465ca96070557feb9e69b898ddb0d4dca2dc (diff)
til_args: add --seed= explicit PRNG seeding support
This enables reproducible yet pseudo-randomized visuals, at least for the fully procedural modules. The modules that are more simulation-y like sparkler and swarm will still have runtime variations since they are dependent on how much the simulation can run and there's been a lot of sloppiness surrounding delta-t correctness and such. But still, in a general sense, you'll find more or less similar results even when doing randomized things like module=rtv,channels=compose using the same seed value. For the moment it only accepts a hexadecimal value, the leading 0x is optional. e.g. these are all valid: --seed=0xdeadbeef --seed=0xdEAdBeFf --seed=0x (produces 0) --seed=0xff --seed=deadbeef --seed=ff --seed= (produces 0) --seed=0 (produces 0) when you exceed the natural word size of an unsigned int on your host architecture, an overflow error will be returned. there are remaining issues to be fixed surrounding PRNG reproducibility, in that things like til_module_randomize_setup() doesn't currently accept a seed value. However it doesn't even use rand_r() currently, but when it invokes desc->random() the module's random() implementation should be able to use rand_r() and needs to be fed the seed. So that all still needs wiring up to propagate the root seed down everywhere it may be relevant.
Diffstat (limited to 'src/til_args.h')
-rw-r--r--src/til_args.h1
1 files changed, 1 insertions, 0 deletions
diff --git a/src/til_args.h b/src/til_args.h
index efe1e3c..d45b619 100644
--- a/src/til_args.h
+++ b/src/til_args.h
@@ -6,6 +6,7 @@
typedef struct til_args_t {
const char *module;
const char *video;
+ const char *seed;
unsigned use_defaults:1;
unsigned help:1;
© All Rights Reserved