-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
* Resolve: Add a variety of masses and radii (#6) * (Revert changes to .idea/codeStyles)
- Loading branch information
1 parent
b49e2b4
commit bfef050
Showing
3 changed files
with
49 additions
and
3 deletions.
There are no files selected for viewing
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
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,20 @@ | ||
#ifndef GRASS_IRHALL_H | ||
#define GRASS_IRHALL_H | ||
|
||
// Irwin-Hall approximation to the uniform distribution. | ||
|
||
namespace phy { | ||
|
||
/// @brief Approximate a normal distribution using a function that generates a | ||
/// uniform (0,1) variate each time it is called using the Irwin-Hall | ||
/// approximation (and the central limit theorem). | ||
template <typename F = float, typename A> F irhnormal(A u01) { | ||
F s{}; | ||
for (unsigned char i = 0; i < 12; i++) | ||
s += u01(); | ||
return s - F(6); | ||
} | ||
|
||
} // namespace phy | ||
|
||
#endif // GRASS_IRHALL_H |
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