Created
March 30, 2018 03:49
-
-
Save simonlc/633c0a7e4fc7db7af06ea869b43f1ddb to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#include <webassembly.h> | |
struct rng_state { | |
unsigned int seed; | |
}; | |
export unsigned short type0_rand(struct rng_state *r) { | |
unsigned int t; | |
t = 0x41C64E6DUL * r->seed + 12345; | |
r->seed = t; | |
return (t >> 10) & 0x7FFF; | |
} | |
void export set_seed(struct rng_state *r, unsigned int seed) { | |
r->seed = seed; | |
} | |
int * export create_randomizer() { | |
struct rng_state r; | |
struct rng_state *r1 = &r; | |
return &r1; | |
} | |
int main(void) { | |
int i, ranvals[5]; | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment