diff --git a/src/spike_source.hpp b/src/spike_source.hpp
index 8a5199bf16eb80411c796bca42708aec5dda96c1..73c54995af39b9cfafd4a87f75ef800442a7c2ab 100644
--- a/src/spike_source.hpp
+++ b/src/spike_source.hpp
@@ -11,7 +11,7 @@ namespace mc {
 class spike_source {
     public:
 
-    virtual std::vector<float> test(float t) = 0;
+    virtual util::optional<float> test(float t) = 0;
 };
 
 // spike detector for a lowered cell
@@ -36,15 +36,15 @@ class spike_detector : public spike_source
         is_spiking_ = previous_v_ >= thresh ? true : false;
     }
 
-    std::vector<float> test(float t) override {
-        std::vector<float> spike_times;
+    util::optional<float> test(float t) override {
+        util::optional<float> result = util::nothing;
         auto v = cell_->voltage(location_);
         if (!is_spiking_) {
             if (v>=threshold_) {
                 // the threshold has been passed, so estimate the time using
                 // linear interpolation
                 auto pos = (threshold_ - previous_v_)/(v - previous_v_);
-                spike_times.push_back(previous_t_ + pos*(t - previous_t_));
+                result = previous_t_ + pos*(t - previous_t_);
 
                 is_spiking_ = true;
             }
@@ -58,7 +58,7 @@ class spike_detector : public spike_source
         previous_v_ = v;
         previous_t_ = t;
 
-        return spike_times;
+        return result;
     }
 
     bool is_spiking() const {
@@ -88,21 +88,25 @@ class poisson_generator : public spike_source
     public:
 
     poisson_generator(float r)
-    :   firing_rate_(r)
+    :   dist_(0.0f, 1.0f),
+        firing_rate_(r)
     {}
 
     util::optional<float> test(float t) {
         // generate a uniformly distrubuted random number x \in [0,1]
         // if  (x > r*dt)  we have a spike in the interval
         std::vector<float> spike_times;
-        if(rand() > firing_rate_*(t-previous_t_)) {
+        if(dist_(generator_) > firing_rate_*(t-previous_t_)) {
             return t;
         }
-        return util::optional<float>::nothing;
+        return util::nothing;
     }
 
     private:
 
+    std::mt19937 generator_; // for now default initialized
+    std::uniform_real_distribution<float> dist_;
+
     // firing rate in spikes/ms
     float firing_rate_;
     float previous_t_;