Last active
July 8, 2022 19:42
-
-
Save theoknock/b1ed573201eb95d73985128db0aa8658 to your computer and use it in GitHub Desktop.
Generating weight-distributed random number calculations Blocks template
This file contains hidden or 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
static double (^(^(^random_generator)(double(^(*))(double)))(double(^(*))(double)))(void) = ^ (double(^(*distributor))(double)) { | |
srand48((unsigned int)time(0)); | |
return ^ (double(^(*number))(double)) { | |
static double random; | |
return ^ double { | |
return (*number)((*distributor)((random = drand48()))); | |
}; | |
}; | |
}; |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment