|
Server : Apache System : Linux server.mata-lashes.com 3.10.0-1160.90.1.el7.x86_64 #1 SMP Thu May 4 15:21:22 UTC 2023 x86_64 User : matalashes ( 1004) PHP Version : 8.1.29 Disable Function : NONE Directory : /usr/share/systemtap/examples/stapgames/tapset/ |
Upload File : |
# Miscellaneous routines for games
# Copyright (C) 2008 Masami Hiramatsu <masami.hiramatsu@gmail.com>
#
# This file is free software and is distributed under the terms of the GNU
# General Public License (GPL); either version 2, or (at your option) any
# later version.
global __GM_rand_seed
function game_srand(seed:long)
{
__GM_rand_seed = seed
}
function __game_lfsr(val:long) /* pure */
%{
u64 r = THIS->val;
r = (r >> 1) ^ ((-(r & 1ULL)) & 0xd800000000000000ULL);
THIS->__retvalue = r;
%}
function game_rand()
{
return __GM_rand_seed = __game_lfsr(__GM_rand_seed)
}
function game_urand()
{
rand = game_rand()
return rand<0?-rand:rand
}