Skip to content

Random Locations

What does the number 360 stand for in this line?
float fRandomSpawnPoints = IntToFloat(Random(360));

Comments

  • ProlericProleric Member Posts: 1,286
    It's requesting a random number in the range 0-359.

    Without context, it's anyone's guess why 360 rather than some other number. Perhaps it's a random bearing (360 degrees in a circle) which, combined with a random distance, would give a random location relative to a fixed point?
  • TheTinmanTheTinman Member Posts: 72
    That makes sense. So would that mean there would be 360 random locations that an object could spawn at?
  • ProlericProleric Member Posts: 1,286
    Without the context (more of the script) I can only speculate, but I'd guess it's one spawnpoint in a random direction.
  • MelkiorMelkior Member Posts: 181
    What Proleric says. Since there are 360 degrees in a complete circle, my first guess too would be that it's a "facing" rather than anything else. It ensures that whatever is spawned won't spawn facing a particular direction, but a random direction.
    But, again like Proleric says, we'd need context to confirm exactly what it's being used for.
Sign In or Register to comment.