Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
SWIFTsim
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
68
Issues
68
List
Boards
Labels
Milestones
Merge Requests
11
Merge Requests
11
Analytics
Analytics
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Commits
Issue Boards
Open sidebar
SWIFT
SWIFTsim
Commits
2c4eb2d8
Commit
2c4eb2d8
authored
Feb 28, 2019
by
Folkert Nobels
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Add documentation to the main function in testRandom.c to explain shortly what the function does
parent
2ebdff41
Changes
1
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
19 additions
and
1 deletion
+19
-1
tests/testRandom.c
tests/testRandom.c
+19
-1
No files found.
tests/testRandom.c
View file @
2c4eb2d8
...
...
@@ -55,6 +55,24 @@ double pearsonfunc(double mean1, double mean2, double total12, double var1, doub
return
fabs
(
correlation
);
}
/**
* @brief Test to check that the pseodo-random numbers in SWIFT are random
* enough for our purpose.
*
* The test initializes with the current time and than creates 20 ID numbers
* it runs the test using these 20 ID numbers. Using these 20 ID numbers it
* Checks 4 different things:
* 1. The mean and variance are correct for random numbers generated by this
* ID number.
* 2. The random numbers from this ID number do not cause correlation in time.
* 3. A small offset in ID number of 2, doesn't cause correlation between
* the two sets of random numbers and the mean and variance of this set is
* also correct.
* 4. Different physical processes in random.h are also uncorrelated and
* produce the correct mean and variance as expected.
*
* @param none
*/
int
main
(
int
argc
,
char
*
argv
[])
{
/* Initialize CPU frequency, this also starts time. */
...
...
@@ -205,7 +223,7 @@ int main(int argc, char* argv[]) {
* distribution */
const
double
tolmean
=
2e-4
;
const
double
tolvar
=
1e-3
;
const
double
tolcorr
=
3
e-4
;
const
double
tolcorr
=
4
e-4
;
if
((
fabs
(
mean
-
0
.
5
)
/
0
.
5
>
tolmean
)
||
(
fabs
(
var
-
1
.
/
12
.)
/
(
1
.
/
12
.)
>
tolvar
)
||
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment