GSC reference › Built-in
RandomFloatRange()
Built-in (engine)
Server
Math
Returns a random floating point number r, where min <= r < max
Signature
RandomFloatRange(<min>, <max>)
Parameters
| Name | Required? | Details |
|---|---|---|
| min | Required | The minimum result |
| max | Required | The maximum result |
Example (from Treyarch's docs)
rand = RandomFloatRange( 3.0, 5.0 )
Real uses in BO3's scripts
Called 1,205 times in the decompiled scripts. A few, zombies first:
- scripts/mp/_ambient.csc, line 118
timer = randomfloatrange(min_burst_time, max_burst_time); - scripts/mp/_blackjack_challenges.gsc, line 572
random_wait_time = getdvarfloat("mp_blackjack_consumable_wait", 20) + (randomfloatrange(-5, 5)); - scripts/mp/_helicopter_sounds.csc, line 805
wait(1 + randomfloatrange(0, 0.2)); - scripts/mp/_nuketown_mannequin.gsc, line 58
mannequin asmsetanimationrate(randomfloatrange(0.98, 1.02)); - scripts/mp/_vehicle.gsc, line 969
return randomfloatrange(mintime, maxtime);
Related built-ins
- RandomIntRange()Returns a random integer r, where min <= r < max
- RandomFloat()Returns a random floating point number r, where 0 <= r < max
- MapFloat()Returns a lerped value between <from> and <to> based on <time>.
- Float()Casts a string or an integer to a float
- LerpFloat()Returns a lerped value between <from> and <to> based on <time>
- GetDvarFloat()Gets the value of a dvar.
- IsFloat()Checks whether this entity/variable is a float
- SetGunnerTurretOnTargetRange()Set the range at which the gunner_turret_on_target notify will occur.
- evSetRanges()Sets the visual range for EV mode
- StrIsFloat()Check if a string is a float.
- SetLightFovRange()Sets the current fov range of the light.
- Int()Casts a floating point number or a string to an integer
New to GSC?
Start with the basics, or paste a compile error to get the fix.
Built-in descriptions, parameters and examples come from Treyarch's BO3 mod tools docs. Usage links point at shiversoftdev/t7-source (decompiled BO3 scripts).