random.hh (7771:e10aff32c561) | random.hh (9235:5aa4896ed55a) |
---|---|
1/* 2 * Copyright (c) 2003-2005 The Regents of The University of Michigan 3 * All rights reserved. 4 * 5 * Redistribution and use in source and binary forms, with or without 6 * modification, are permitted provided that the following conditions are 7 * met: redistributions of source code must retain the above copyright 8 * notice, this list of conditions and the following disclaimer; --- 28 unchanged lines hidden (view full) --- 37 */ 38 39#ifndef __BASE_RANDOM_HH__ 40#define __BASE_RANDOM_HH__ 41 42#include <ios> 43#include <string> 44 | 1/* 2 * Copyright (c) 2003-2005 The Regents of The University of Michigan 3 * All rights reserved. 4 * 5 * Redistribution and use in source and binary forms, with or without 6 * modification, are permitted provided that the following conditions are 7 * met: redistributions of source code must retain the above copyright 8 * notice, this list of conditions and the following disclaimer; --- 28 unchanged lines hidden (view full) --- 37 */ 38 39#ifndef __BASE_RANDOM_HH__ 40#define __BASE_RANDOM_HH__ 41 42#include <ios> 43#include <string> 44 |
45#include "base/range.hh" | |
46#include "base/types.hh" 47 48class Checkpoint; 49 50class Random 51{ 52 protected: 53 static const int N = 624; --- 151 unchanged lines hidden (view full) --- 205 206 template <typename T> 207 T 208 random(T min, T max) 209 { 210 return _random(min, max); 211 } 212 | 45#include "base/types.hh" 46 47class Checkpoint; 48 49class Random 50{ 51 protected: 52 static const int N = 624; --- 151 unchanged lines hidden (view full) --- 204 205 template <typename T> 206 T 207 random(T min, T max) 208 { 209 return _random(min, max); 210 } 211 |
213 template <typename T> 214 T 215 random(const Range<T> &range) 216 { 217 return _random(range.start, range.end); 218 } 219 | |
220 // [0,1] 221 double 222 gen_real1() 223 { 224 return genrand() / 4294967296.0; 225 } 226 227 // [0,1) --- 22 unchanged lines hidden --- | 212 // [0,1] 213 double 214 gen_real1() 215 { 216 return genrand() / 4294967296.0; 217 } 218 219 // [0,1) --- 22 unchanged lines hidden --- |