mirror of
https://github.com/MihailRis/voxelcore.git
synced 2026-10-04 18:41:51 +00:00
fix random.random range
This commit is contained in:
parent
dc21a8ea51
commit
28afa4b6bf
1 changed files with 2 additions and 2 deletions
|
|
@ -12,11 +12,11 @@ static int l_random(lua::State* L) {
|
|||
std::uniform_real_distribution<> dist(0.0, 1.0);
|
||||
return lua::pushnumber(L, dist(randomEngine));
|
||||
} else if (argc == 1) {
|
||||
std::uniform_int_distribution<integer_t> dist(0, lua::tointeger(L, 1) - 1);
|
||||
std::uniform_int_distribution<integer_t> dist(0, lua::tointeger(L, 1));
|
||||
return lua::pushinteger(L, dist(randomEngine));
|
||||
} else {
|
||||
std::uniform_int_distribution<integer_t> dist(
|
||||
lua::tointeger(L, 1), lua::tointeger(L, 2) - 1
|
||||
lua::tointeger(L, 1), lua::tointeger(L, 2)
|
||||
);
|
||||
return lua::pushinteger(L, dist(randomEngine));
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue