Commit a758fb09 authored by Davis King's avatar Davis King

Added a constructor for seeding rand with a time_t.

parent f33d1ff1
......@@ -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
)
......
......@@ -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
);
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment