Lib
QOLを高める
Public Member Functions | Static Public Member Functions | List of all members
yappy::lua::export::rand Struct Reference

乱数関連関数。randグローバルテーブルに提供。 More...

#include <script_export.h>

Public Member Functions

 rand ()=delete
 

Static Public Member Functions

static int generateSeed (lua_State *L)
 乱数シード用の値を生成する。 More...
 
static int setSeed (lua_State *L)
 乱数のシード値を設定する。 More...
 
static int nextInt (lua_State *L)
 次の整数乱数を生成する。 More...
 
static int nextDouble (lua_State *L)
 次の浮動小数点乱数を生成する。 More...
 

Detailed Description

乱数関連関数。randグローバルテーブルに提供。

rand = {};

Definition at line 65 of file script_export.h.

Constructor & Destructor Documentation

yappy::lua::export::rand::rand ( )
delete

Member Function Documentation

int yappy::lua::export::rand::generateSeed ( lua_State *  L)
static

乱数シード用の値を生成する。

function rand.generateSeed()
end
Returns
シード用の整数乱数
See also
framework::random::generateRandomSeed()

Definition at line 355 of file script_export.cpp.

int yappy::lua::export::rand::nextDouble ( lua_State *  L)
static

次の浮動小数点乱数を生成する。

function rand.nextDouble(double a = 0.0, double b = 1.0)
end
Parameters
[in]a最小値(含む)
[in]b最大値(含まない)
Returns
[a, b) のランダムな値
See also
framework::random::nextInt()

Definition at line 428 of file script_export.cpp.

int yappy::lua::export::rand::nextInt ( lua_State *  L)
static

次の整数乱数を生成する。

function rand.nextInt(int a = 0, int b = 0x7fffffff)
end
Parameters
[in]a最小値(含む)
[in]b最大値(含む)
Returns
[a, b] のランダムな値
See also
framework::random::nextInt()

Definition at line 401 of file script_export.cpp.

int yappy::lua::export::rand::setSeed ( lua_State *  L)
static

乱数のシード値を設定する。

function rand.setSeed(int seed)
end

シード値を設定しないと毎回同じ乱数が出てきてしまいます。 初めに generateSeed() で生成した乱数値をシードに設定してください。 逆に同じシードを設定すると同じ乱数列を再現できます。

Parameters
[in]seed設定するシード値
Returns
なし
See also
framework::random::setSeed()

Definition at line 379 of file script_export.cpp.


The documentation for this struct was generated from the following files: