Search Unity

  1. Unity Asset Manager is now available in public beta. Try it out now and join the conversation here in the forums.
    Dismiss Notice
  2. Megacity Metro Demo now available. Download now.
    Dismiss Notice
  3. Unity support for visionOS is now available. Learn more in our blog post.
    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