-
Notifications
You must be signed in to change notification settings - Fork 160
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
8d4868e
commit aa08e11
Showing
14 changed files
with
844 additions
and
2 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,77 @@ | ||
# discard | ||
* random[meta header] | ||
* std[meta namespace] | ||
* philox_engine[meta class] | ||
* function[meta id-type] | ||
* cpp26[meta cpp] | ||
|
||
```cpp | ||
void discard(unsigned long long z); | ||
``` | ||
## 概要 | ||
指定した回数だけ擬似乱数を生成し、内部状態を進める。 | ||
## 効果 | ||
`*this`を`e`とした場合、 | ||
```cpp | ||
for (unsigned long long i = 0; i < z; ++i) { | ||
e(); | ||
} | ||
``` | ||
* e()[link op_call.md] | ||
|
||
と同じ効果を持つ。 | ||
|
||
指定された回数だけ乱数生成を行い、結果を破棄する。 | ||
|
||
|
||
## 戻り値 | ||
なし | ||
|
||
|
||
## 例 | ||
```cpp example | ||
#include <iostream> | ||
#include <random> | ||
|
||
int main() | ||
{ | ||
std::philox4x32 engine; | ||
|
||
for (int i = 0; i < 5; ++i) { | ||
engine(); | ||
} | ||
|
||
std::cout << engine() << std::endl; | ||
|
||
// エンジンを再初期化し、内部状態を5回進める | ||
// 上のコードで生成した乱数と同じ結果が得られる | ||
engine.seed(); | ||
engine.discard(5); | ||
|
||
std::cout << engine() << std::endl; | ||
} | ||
``` | ||
* discard[color ff0000] | ||
* engine()[link op_call.md] | ||
* seed()[link seed.md] | ||
|
||
### 出力 | ||
``` | ||
3200855668 | ||
3200855668 | ||
``` | ||
|
||
## バージョン | ||
### 言語 | ||
- C++26 | ||
|
||
### 処理系 | ||
- [Clang](/implementation.md#clang): 19 [mark noimpl] | ||
- [GCC](/implementation.md#gcc): 14 [mark noimpl] | ||
- [ICC](/implementation.md#icc): ?? | ||
- [Visual C++](/implementation.md#visual_cpp): ?? | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,51 @@ | ||
# max | ||
* random[meta header] | ||
* std[meta namespace] | ||
* philox_engine[meta class] | ||
* function[meta id-type] | ||
* cpp26[meta cpp] | ||
|
||
```cpp | ||
static constexpr result_type max(); | ||
``` | ||
|
||
## 概要 | ||
生成し得る値の最大値を取得する。 | ||
|
||
|
||
## 戻り値 | ||
`2^w - 1`を返す。 | ||
|
||
|
||
## 計算量 | ||
定数時間 | ||
|
||
|
||
## 例 | ||
```cpp example | ||
#include <iostream> | ||
#include <random> | ||
|
||
int main() | ||
{ | ||
std::uint32_t max_value = std::philox4x32::max(); | ||
std::cout << max_value << std::endl; | ||
} | ||
``` | ||
* max()[color ff0000] | ||
* std::uint32_t[link /reference/cstdint/uint32_t.md] | ||
|
||
### 出力 | ||
``` | ||
4294967295 | ||
``` | ||
|
||
## バージョン | ||
### 言語 | ||
- C++26 | ||
|
||
### 処理系 | ||
- [Clang](/implementation.md#clang): 19 [mark noimpl] | ||
- [GCC](/implementation.md#gcc): 14 [mark noimpl] | ||
- [ICC](/implementation.md#icc): ?? | ||
- [Visual C++](/implementation.md#visual_cpp): ?? |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,51 @@ | ||
# min | ||
* random[meta header] | ||
* std[meta namespace] | ||
* philox_engine[meta class] | ||
* function[meta id-type] | ||
* cpp26[meta cpp] | ||
|
||
```cpp | ||
static constexpr result_type min(); | ||
``` | ||
|
||
## 概要 | ||
生成し得る値の最小値を取得する。 | ||
|
||
|
||
## 戻り値 | ||
最小値である`0`を返す。 | ||
|
||
|
||
## 計算量 | ||
定数時間 | ||
|
||
|
||
## 例 | ||
```cpp example | ||
#include <iostream> | ||
#include <random> | ||
|
||
int main() | ||
{ | ||
std::uint32_t min_value = std::philox4x32::min(); | ||
std::cout << min_value << std::endl; | ||
} | ||
``` | ||
* min()[color ff0000] | ||
* std::uint32_t[link /reference/cstdint/uint32_t.md] | ||
|
||
### 出力 | ||
``` | ||
0 | ||
``` | ||
|
||
## バージョン | ||
### 言語 | ||
- C++26 | ||
|
||
### 処理系 | ||
- [Clang](/implementation.md#clang): 19 [mark noimpl] | ||
- [GCC](/implementation.md#gcc): 14 [mark noimpl] | ||
- [ICC](/implementation.md#icc): ?? | ||
- [Visual C++](/implementation.md#visual_cpp): ?? |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,70 @@ | ||
# operator() | ||
* random[meta header] | ||
* std[meta namespace] | ||
* philox_engine[meta class] | ||
* function[meta id-type] | ||
* cpp26[meta cpp] | ||
|
||
```cpp | ||
result_type operator()(); | ||
``` | ||
|
||
## 概要 | ||
乱数生成を行う。 | ||
|
||
|
||
## 効果 | ||
ランダムな値を生成し、内部状態を進める。 | ||
|
||
|
||
## 戻り値 | ||
ランダムな値を生成して返す。 | ||
値の範囲は`[`[`min()`](min.md), [`max()`](max.md)`]`である。つまり、最小値と最大値両方を含む。 | ||
|
||
|
||
## 計算量 | ||
償却定数時間 | ||
|
||
|
||
## 例 | ||
```cpp example | ||
#include <iostream> | ||
#include <random> | ||
|
||
int main() | ||
{ | ||
std::philox4x32 engine; | ||
|
||
for (int i = 0; i < 10; ++i) { | ||
// 乱数生成 | ||
std::uint32_t result = engine(); | ||
std::cout << result << std::endl; | ||
} | ||
} | ||
``` | ||
* engine()[color ff0000] | ||
* std::uint32_t[link /reference/cstdint/uint32_t.md] | ||
|
||
### 出力例 | ||
``` | ||
3587538684 | ||
1324224816 | ||
3068087177 | ||
2030706281 | ||
1694797232 | ||
3200855668 | ||
284762628 | ||
612470539 | ||
492986243 | ||
2306264815 | ||
``` | ||
|
||
## バージョン | ||
### 言語 | ||
- C++26 | ||
|
||
### 処理系 | ||
- [Clang](/implementation.md#clang): 19 [mark noimpl] | ||
- [GCC](/implementation.md#gcc): 14 [mark noimpl] | ||
- [ICC](/implementation.md#icc): ?? | ||
- [Visual C++](/implementation.md#visual_cpp): ?? |
Oops, something went wrong.