Return Styles: Pseud0ch, Terminal, Valhalla, NES, Geocities, Blue Moon. Entire thread

/frog/ challenge sqrt(-2): unique (pseudo)random snowflake numbers

Name: Anonymous 2019-01-22 12:49

your're are task: implement a random number generator which works according to the following specification:
  • takes two command-line arguments; first will be the seed, second will be how many numbers to generate
  • outputs numbers separated by newline to stdout
  • if called \(2^{32}\) times, it will output each \(x\) defined as \(0 <= x < 2^{32}\) exactly once
  • order of such outputs will not be trivially predictable, but it doesn't have to be cryptographically secure: \(0, 1, 2, 3 ... 2^{32}\) is not ok but an LSFR is
  • each seed should generate a different sequence, there should not be a single sequence with seeds working as offsets into it

you have one week. the shortest code (in bytes of source code or compiled executable) wins, but submissions will be scored in two separate categories: those that achieve uniqueness algorithmically and those that guarantee it by explicitly caching the results. the category which does not use caching should be seen as the more prestigious one since caching is a trivial hack and it will ruin performance and/or memory usage for large sequences

Name: Anonymous 2019-01-22 13:55

>>2
does not meet the spec:
  • no uniqueness guarantee
  • no argv[] parsing
  • no other way to specify a seed
  • no other way to specify how many numbers to output
  • most importantly, no guarantee that all 32-bit numbers will be printed exactly once

Newer Posts
Don't change these.
Name: Email:
Entire Thread Thread List