Blame toonz/sources/stdfx/igs_math_random.h
|
Toshihiro Shimizu |
890ddd |
#ifndef igs_math_random_h
|
|
Toshihiro Shimizu |
890ddd |
#define igs_math_random_h
|
|
Toshihiro Shimizu |
890ddd |
|
|
Toshihiro Shimizu |
890ddd |
/*
|
|
Toshihiro Shimizu |
890ddd |
履歴
|
|
Toshihiro Shimizu |
890ddd |
2001-04-25 update
|
|
Toshihiro Shimizu |
890ddd |
2001-06-19 rename to 'calculator_random_plus_long.h'
|
|
Toshihiro Shimizu |
890ddd |
2005-02-03 rename to 'ptbl_random.h'
|
|
Toshihiro Shimizu |
890ddd |
2005-02-10 separete to 'ptbl_random.h' and 'ptbl_random.cxx'
|
|
Toshihiro Shimizu |
890ddd |
解説 (2005-02-03.thu wrote)
|
|
Toshihiro Shimizu |
890ddd |
疑似乱数整数列発生関数rand()は処理系定義であるため、
|
|
Toshihiro Shimizu |
890ddd |
たとえば、radhat9とWindowsとでは疑似乱数列が違う。
|
|
Toshihiro Shimizu |
890ddd |
また、random()関数は、radhat9にはあるが、MS-Cにはない。
|
|
Toshihiro Shimizu |
890ddd |
よって、ポータビリティを持たせるため独立した関数定義をする
|
|
Toshihiro Shimizu |
890ddd |
参考:「ANSI C/C++辞典」 平林雅英 共立出版株式会社
|
|
Toshihiro Shimizu |
890ddd |
*/
|
|
Toshihiro Shimizu |
890ddd |
|
|
Toshihiro Shimizu |
890ddd |
namespace igs
|
|
Toshihiro Shimizu |
890ddd |
{
|
|
Toshihiro Shimizu |
890ddd |
namespace math
|
|
Toshihiro Shimizu |
890ddd |
{
|
|
Toshihiro Shimizu |
890ddd |
class random
|
|
Toshihiro Shimizu |
890ddd |
{
|
|
Toshihiro Shimizu |
890ddd |
public:
|
|
Toshihiro Shimizu |
890ddd |
random();
|
|
Toshihiro Shimizu |
890ddd |
|
|
Toshihiro Shimizu |
890ddd |
/* 乱数種 seed(0〜std::numeric_limits<long>::max()) */</long>
|
|
Toshihiro Shimizu |
890ddd |
void seed(unsigned long seed);
|
|
Toshihiro Shimizu |
890ddd |
unsigned long seed(void) const;
|
|
Toshihiro Shimizu |
890ddd |
|
|
Toshihiro Shimizu |
890ddd |
/* 乱数生成 0〜std::numeric_limits<long>::max() */</long>
|
|
Toshihiro Shimizu |
890ddd |
long next(void);
|
|
Toshihiro Shimizu |
890ddd |
double next_d(void); /* 0 ... 1 */
|
|
Toshihiro Shimizu |
890ddd |
private:
|
|
Toshihiro Shimizu |
890ddd |
unsigned long seed_;
|
|
Toshihiro Shimizu |
890ddd |
};
|
|
Toshihiro Shimizu |
890ddd |
}
|
|
Toshihiro Shimizu |
890ddd |
}
|
|
Toshihiro Shimizu |
890ddd |
|
|
Toshihiro Shimizu |
890ddd |
#endif /* !igs_math_random_h */
|