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
a758fb09
Commit
a758fb09
authored
Mar 18, 2016
by
Davis King
Browse files
Added a constructor for seeding rand with a time_t.
parent
f33d1ff1
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
22 additions
and
0 deletions
+22
-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
+13
-0
No files found.
dlib/rand/rand_kernel_1.h
View file @
a758fb09
...
...
@@ -10,6 +10,7 @@
#include "../is_kind.h"
#include <iostream>
#include "../serialize.h"
#include "../string.h"
namespace
dlib
{
...
...
@@ -39,6 +40,14 @@ namespace dlib
init
();
}
rand
(
time_t
seed_value
)
{
init
();
set_seed
(
cast_to_string
(
seed_value
));
}
rand
(
const
std
::
string
&
seed_value
)
...
...
dlib/rand/rand_kernel_abstract.h
View file @
a758fb09
...
...
@@ -34,6 +34,19 @@ namespace dlib
- std::bad_alloc
!*/
rand
(
time_t
seed_value
);
/*!
ensures
- #*this is properly initialized
- #get_seed() == cast_to_string(seed_value)
- This version of the constructor is equivalent to using
the default constructor and then calling set_seed(cast_to_string(seed_value))
throws
- std::bad_alloc
!*/
rand
(
const
std
::
string
&
seed_value
);
...
...
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