Search Unity

  1. Welcome to the Unity Forums! Please take the time to read our Code of Conduct to familiarize yourself with the forum rules and how to post constructively.
  2. Dismiss Notice

how to generate a random number(int or float) in tiny unity?

Discussion in 'Project Tiny' started by apoorv_baked, Feb 1, 2019.

  1. apoorv_baked

    apoorv_baked

    Joined:
    Feb 1, 2019
    Posts:
    5
    I cant find any reference of how generate a random number from a typescript system . Please help.
     
  2. abeisgreat

    abeisgreat

    Joined:
    Nov 21, 2016
    Posts:
    44
    Code (JavaScript):
    1. Math.random() // Random float between 0-1
    2. Math.random() * 50 // Random float between 0 - 50
    3. Math.floor(Math.random() * 50) // Random int between 0 - 50