FP is great for stretching your mind and helping you form deeper abstractions around code. The idea that functions are data ... awesome. Recursion. Immutability. Declarative programming styles. Composition. We are spoiled with riches!
-
-
I hope he doesn't mind because I didn't ask! I've chosen
@lemire's algorithm because it is awesome and ground breaking, very short, and intrinsically hard to follow if you're not into the math.Show this thread -
His blog post contains a 14 line implementation in C, and there's also a paper getting into it: https://arxiv.org/abs/1805.10941 , so there's great material to start from. But how can we make it more readable and easy to follow for a beginner or non-math-expert? how can we test it?
Show this thread -
Have at it and give it a go! Any programming language you like. Apache Software License so that it can be included in other things. Closing date: September 1st 2019.
Show this thread -
Message me a gist, or a link, or send me an e-mail, whatever works ... and we can talk readability and testing about it too!
Show this thread -
For further reference: here's my rejection sampling RNG implementation with more comments than code. https://github.com/awslabs/s2n/blob/master/utils/s2n_random.c#L182 … End of thread!
Show this thread
End of conversation
New conversation -
-
-
Where can I find details on the contest and what's the deadline?
-
It's at the bottom of the tweet thread :)
- 1 more reply
New conversation -
-
-
int getRandomNumber(int s) { return 4; // chosen by Lemire's algorithm // guaranteed to be uniformly distributed }
Thanks. Twitter will use this to make your timeline better. UndoUndo
-
-
This Tweet is unavailable.
Loading seems to be taking a while.
Twitter may be over capacity or experiencing a momentary hiccup. Try again or visit Twitter Status for more information.