Defines | Functions

rnd.c File Reference

#include "hack.h"
Include dependency graph for rnd.c:

Defines

#define RND(x)   (int)((Rand()>>3) % (x))

Functions

int rn2 (int x)
int rnl (int x)
int rnd (int x)
int d (int n, int x)
int rne (int x)
int rnz (int i)
int rnf (int numerator, int denominator)

Define Documentation

#define RND (   x )    (int)((Rand()>>3) % (x))

Referenced by d(), rn2(), rnd(), and rnl().


Function Documentation

int d ( int  n,
int  x 
)
int rn2 ( int  x )

References RND.

Referenced by abuse_dog(), addtobill(), aggravate(), amulet(), angrygods(), artifact_hit(), attack(), badpos(), bagotricks(), ballfall(), bhit(), bhitm(), blessorcurse(), boomhit(), bottlename(), boulder_hits_pool(), breamu(), build_room(), burn_floor_paper(), burnarmor(), buzz(), buzzmu(), can_make_bones(), can_pray(), cast_wizard_spell(), castmu(), catch_lit(), check_leash(), check_room(), check_special_room(), check_unpaid_usage(), chest_trap(), choke(), choke_dialogue(), chwepon(), clone_mon(), clonewiz(), close_drawbridge(), confdir(), confused_book(), consume_offering(), container_impact_dmg(), corpse_chance(), courtmon(), coyotename(), cpostfx(), create_altar(), create_camera_demon(), create_door(), create_monster(), create_mplayers(), create_polymon(), create_room(), create_secret_door(), create_subroom(), cursed_book(), cursetxt(), cuss(), cutworm(), damageum(), deadbook(), demonpet(), destroy_item(), destroy_mitem(), dev_name(), dig(), dig_corridor(), dig_up_grave(), dighole(), dip(), dipfountain(), distfleeck(), disturb(), djinni_from_bottle(), do_break_wand(), do_earthquake(), do_flood(), do_improvisation(), do_oname(), do_osshock(), do_storms(), doapply(), dochug(), doclose(), dodoor(), dodrink(), doeat(), dofiretrap(), dog_goal(), dog_invent(), dog_move(), dogaze(), dokick(), domindblast(), domonnoise(), domove(), done(), done_eating(), dopay(), dorub(), dosacrifice(), dosdoor(), dosit(), dosounds(), dotrap(), dozap(), drag_ball(), drag_down(), drinkfountain(), drop_ball(), drop_throw(), drop_upon_death(), drown(), dryup(), eataccessory(), eatcorpse(), emergency_disrobe(), enexto_core_range(), engrave(), epathto(), exerchk(), exercise(), fall_through(), fightm(), fill_empty_maze(), fill_zoo(), fillholetyp(), find_branch_room(), find_defensive(), find_offensive(), find_roll_to_hit(), finddpos(), finish_paybill(), fire_damage(), fix_attributes_and_properties(), fixup_special(), flash_hits_mon(), flip_level_rnd(), forcelock(), forget(), forget_map(), fpostfx(), fprefx(), gainstr(), gazemu(), gd_move(), gem_accept(), get_location(), get_mplname(), get_room_loc(), get_wet(), getbones(), getdir(), gethungry(), getrumor(), ghitm(), ghod_hitsu(), givit(), godvoice(), goodpos(), goto_level(), grease_protect(), grow_up(), growl(), gulpmu(), gulpum(), gush(), hatch_egg(), hcolor(), Helmet_on(), help_monster_out(), hitmu(), hmon(), hmon_hitmon(), hmonas(), hurtarmor(), hurtmarmor(), impact_drop(), induced_align(), inherits(), init_attr(), init_dungeons(), init_level(), init_objects(), intemple(), intervene(), join_map(), joust(), jump(), kick_monster(), kick_object(), kickdmg(), known_hitum(), launch_obj(), learn(), level_distance(), m_initinv(), m_initweap(), m_move(), m_respond(), m_slips_free(), m_throw(), make_corpse(), make_familiar(), make_grave(), make_ironbarwalls(), make_niches(), makecorridors(), makedog(), makelevel(), makemaz(), makemon(), makeniche(), makerooms(), makewish(), mattacku(), maze0xy(), mazexy(), Mb_hit(), mbag_explodes(), mcalcdistress(), mcalcmove(), mdamagem(), mdig_tunnel(), mineralize(), minliquid(), mintrap(), mixtype(), mk_artifact(), mk_bubble(), mk_knox_portal(), mk_mplayer(), mk_mplayer_armor(), mk_split_room(), mkaltar(), mkbox_cnts(), mkclass(), mkfount(), mkgarden(), mkgrave(), mkmap(), mkpoolroom(), mkroll_launch(), mkshobj_at(), mksobj(), mkswamp(), mktrap(), mon_arrive(), mon_catchup_elapsed_time(), mongets(), monkilled(), monstone(), morguemon(), move_gold(), move_special(), movebubbles(), moveloop(), moverock(), mplayer_talk(), mrustm(), msummon(), mv_bubble(), nameshk(), nasty(), nemesis_speaks(), newcham(), newman(), newuhs(), noisy_hit(), noncoalignment(), obj_no_longer_held(), obj_resists(), obj_shudders(), observe_quantum_cat(), ohitmon(), omon_adj(), opentin(), outrumor(), parent_dlevel(), passive(), passive_obj(), passivemm(), passiveum(), pay_for_damage(), paygd(), peace_minded(), peffects(), pet_type(), pick_align(), pick_animal(), pick_gend(), pick_nasty(), pick_race(), pick_role(), pick_room(), picklock(), place_level(), place_niche(), place_random_engraving(), pleased(), poisoned(), poly_obj(), polymon(), polyself(), polyuse(), potionbreathe(), potionhit(), precheck(), priest_talk(), priestini(), randalign(), randgend(), random_dir(), random_engraving(), random_teleport_level(), randomize(), randrace(), randrole(), readobjnam(), recharge(), redist_attr(), remove_damage(), repair_damage(), replace_terrain(), resist(), restrap(), resurrect(), revive(), reward_untrap(), rloc(), rloc_engr(), rloco(), rnd_class(), rnd_defensive_item(), rnd_gname(), rnd_misc_item(), rnd_offensive_item(), rnd_rect(), rnd_treefruit_at(), rndcolor(), rndcurse(), rnddoor(), rndexp(), rndghostname(), rndmonst(), rnf(), rnl(), rnz(), rottenfood(), safe_teleds(), scatter(), seffects(), select_newcham_form(), selection_filter_percent(), selection_rndcoord(), set_apparxy(), set_mimic_sym(), setup_waterlevel(), ship_object(), shk_chat(), shk_embellish(), shk_move(), shkinit(), show_map_spot(), shuffle(), shuffle_alignments(), shuffle_all(), slip_or_trip(), some_armor(), somex(), somey(), sp_level_coder(), spec_applies(), spell_backfire(), spill_terrain(), spitmu(), splev_initlev(), spo_region(), spo_shuffle_array(), squadmon(), start_corpse_timeout(), steal(), stealgold(), study_book(), summon_minion(), tactics(), tamedog(), thitmonst(), throwit(), thrwmu(), tmiss(), touch_artifact(), u_init(), u_on_sstairs(), u_slip_free(), u_teleport_mon(), untrap(), untrap_prob(), urustm(), use_bell(), use_container(), use_crystal_ball(), use_defensive(), use_grapple(), use_grease(), use_lamp(), use_magic_whistle(), use_mirror(), use_misc(), use_offensive(), use_pick_axe2(), use_stethoscope(), use_towel(), use_whip(), walkfrom(), wallwalk_right(), wary_dog(), watch_on_duty(), water_damage(), water_friction(), were_change(), were_summon(), whimper(), wildmiss(), wipe_engr_at(), wipeout_text(), xkilled(), yelp(), zap_hit(), zap_updown(), zapnodir(), zappable(), zapyourself(), zhitm(), and zhitu().

Here is the caller graph for this function:

int rnd ( int  x )

References RND.

Referenced by Amulet_on(), arti_invoke(), artifact_hit(), assign_rnd_level(), attach_egg_hatch_timeout(), attach_fig_transform_timeout(), attack(), attrcurse(), b_trapped(), bagotricks(), bhitm(), boomhit(), Boots_on(), breamu(), bury_an_obj(), cancel_monst(), cast_cleric_spell(), cast_wizard_spell(), check_leash(), cpostfx(), create_gold(), create_mplayers(), create_room(), create_subroom(), cthulhu_dies(), cursed_book(), cutworm(), damageum(), demon_talk(), destroy_item(), dig(), dip(), dipfountain(), distfleeck(), djinni_from_bottle(), dmgval(), do_break_wand(), do_earthquake(), do_osshock(), do_storms(), dochug(), doeat(), dofiretrap(), dog_move(), dokick(), doloot(), domagictrap(), domindblast(), domove(), dosacrifice(), dosit(), dotrap(), dotwoweapon(), dowaterdemon(), drag_ball(), drag_down(), drinkfountain(), e_jumps(), e_missed(), eataccessory(), eatcorpse(), engrave(), explmu(), fig_transform(), fill_empty_maze(), final_level(), fix_attributes_and_properties(), fix_worst_trouble(), fixup_special(), flash_hits_mon(), float_down(), flooreffects(), fpostfx(), fprefx(), fruitadd(), gainstr(), gazemu(), get_override_mon(), get_shop_item(), get_wet(), Gloves_on(), goto_level(), grow_up(), gulpmu(), hatch_egg(), hitmu(), hitum(), hmon_hitmon(), hmonas(), hurtle_step(), init_fill(), inside_gas_cloud(), intervene(), jump(), kick_monster(), kick_object(), kickdmg(), known_hitum(), litter(), loot_mon(), losespells(), m_initgrp(), m_initinv(), m_initweap(), m_throw(), make_corpse(), make_engr_at(), make_niches(), makemaz(), makemon(), mattackm(), mattacku(), Mb_hit(), mb_trapped(), mbhitm(), mdamagem(), mdig_tunnel(), meatmetal(), mineralize(), mintrap(), mk_mplayer(), mk_mplayer_armor(), mk_split_room(), mkbox_cnts(), mkclass(), mkgold(), mkmap(), mkobj(), mkshop(), mksobj(), mktrap(), mkundead(), mon_consume_unstone(), moveloop(), nasty(), newhp(), nh_timeout(), obj_delivery(), ohitmon(), opentin(), outoracle(), peffects(), pluslvl(), poisoned(), poly_obj(), polymon(), polyself(), potionbreathe(), potionhit(), prayer_done(), random_teleport_level(), readobjnam(), recharge(), rnd_class(), rndcurse(), rndmonst(), rndtrap(), rottenfood(), safe_teleds(), scatter(), seffects(), shkinit(), somegold(), spec_abon(), spec_dbon(), spelleffects(), spo_region(), spoteffects(), squadmon(), still_chewing(), study_book(), tactics(), thitm(), thitmonst(), thitu(), throw_obj(), throwit(), thrwmu(), toss_up(), try_disarm(), tt_oname(), u_init(), u_on_sstairs(), untrap(), use_bell(), use_cream_pie(), use_crystal_ball(), use_defensive(), use_grease(), use_mirror(), use_pick_axe2(), use_whip(), wand_explode(), were_summon(), worm_move(), zap_dig(), zap_hit(), zap_updown(), zapyourself(), and zhitm().

Here is the caller graph for this function:

int rne ( int  x )

References rnf(), u, and you::ulevel.

Referenced by ini_inv(), mksobj(), and rnz().

Here is the call graph for this function:

Here is the caller graph for this function:

int rnf ( int  numerator,
int  denominator 
)

References rn2().

Referenced by eatcorpse(), flooreffects(), mksobj(), rne(), throwit(), trim_contents(), and u_teleport_mon().

Here is the call graph for this function:

Here is the caller graph for this function:

int rnl ( int  x )
Parameters:
xgood luck approaches 0, bad luck approaches (x-1)

References Luck, rn2(), and RND.

Referenced by disarm_shooting_trap(), dokick(), dosacrifice(), dosearch0(), dowrite(), fire_damage(), hmon_hitmon(), joust(), level_tele(), make_corpse(), mintrap(), mon_break_armor(), pleased(), polymon(), prayer_done(), reward_untrap(), rust_dmg(), set_trap(), thitmonst(), try_disarm(), try_lift(), use_trap(), use_whip(), and water_damage().

Here is the call graph for this function:

Here is the caller graph for this function:

int rnz ( int  i )

References rn2(), and rne().

Referenced by angrygods(), arti_invoke(), dodown(), dosacrifice(), pleased(), prayer_done(), and start_corpse_timeout().

Here is the call graph for this function:

Here is the caller graph for this function: