Skip to content
GitLab
Menu
Projects
Groups
Snippets
Loading...
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
Menu
Open sidebar
OpenDAS
dlib
Commits
c324a65e
Commit
c324a65e
authored
Sep 04, 2016
by
Davis King
Browse files
Added get_double_in_range() to dlib::rand.
parent
1970bf29
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
23 additions
and
0 deletions
+23
-0
dlib/rand/rand_kernel_1.h
dlib/rand/rand_kernel_1.h
+9
-0
dlib/rand/rand_kernel_abstract.h
dlib/rand/rand_kernel_abstract.h
+14
-0
No files found.
dlib/rand/rand_kernel_1.h
View file @
c324a65e
...
@@ -137,6 +137,15 @@ namespace dlib
...
@@ -137,6 +137,15 @@ namespace dlib
return
(
a
<<
32
)
|
b
;
return
(
a
<<
32
)
|
b
;
}
}
double
get_double_in_range
(
double
begin
,
double
end
)
{
DLIB_ASSERT
(
begin
<=
end
);
return
begin
+
get_random_double
()
*
(
end
-
begin
);
}
double
get_random_double
(
double
get_random_double
(
)
)
{
{
...
...
dlib/rand/rand_kernel_abstract.h
View file @
c324a65e
...
@@ -135,6 +135,20 @@ namespace dlib
...
@@ -135,6 +135,20 @@ namespace dlib
- returns a random double number N where: 0.0 <= N < 1.0.
- returns a random double number N where: 0.0 <= N < 1.0.
!*/
!*/
double
get_double_in_range
(
double
begin
,
double
end
);
/*!
requires
- begin <= end
ensures
- if (begin < end) then
- returns a random double number N where: begin <= N < end.
- else
- returns begin
!*/
double
get_random_gaussian
(
double
get_random_gaussian
(
);
);
/*!
/*!
...
...
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