generic image
Processing...
  • Games
  • Catalog
  • Develop
  • Robux
  • Search in Players
  • Search in Games
  • Search in Catalog
  • Search in Groups
  • Search in Library
  • Log In
  • Sign Up
  • Games
  • Catalog
  • Develop
  • Robux
   
ROBLOX Forum » Game Creation and Development » Scripters
Home Search
 

Re: is it just me that math.random works badly?

Previous Thread :: Next Thread 
Festivereinhard2 is not online. Festivereinhard2
Joined: 08 Dec 2015
Total Posts: 587
22 Apr 2017 05:22 PM
I have this script which takes a prints a random value using math.random(1,4) every second. However it keeps printing 4, and doesnt change!
Report Abuse
NilLogic is not online. NilLogic
Joined: 08 Apr 2016
Total Posts: 1369
22 Apr 2017 05:22 PM
I think the link(s) below may be of use to you:


Join the fan group: https://www.roblox.com/My/Groups.aspx?gid=3201548
Report Abuse
Unsubtleties is not online. Unsubtleties
Joined: 28 Nov 2016
Total Posts: 9203
22 Apr 2017 05:24 PM
Call `math.randomseed(tick())` to seed the pseudo-random generator and call math.random once after it. After that you should start getting "random" numbers.

The reason you are getting the same outcome over and over is because math.random technically isn't random and operates on a seed that doesn't change by default.


Report Abuse
Oryxide is not online. Oryxide
Joined: 09 Jul 2015
Total Posts: 647
22 Apr 2017 05:46 PM
A mod should just pin a thread relating to Math.Random.
Report Abuse
Unsubtleties is not online. Unsubtleties
Joined: 28 Nov 2016
Total Posts: 9203
22 Apr 2017 05:46 PM
No, they really shouldn't. This has been explained countless times already and it's all over the Internet.


Report Abuse
xxxtentaci_on is not online. xxxtentaci_on
Joined: 08 Jan 2012
Total Posts: 1767
22 Apr 2017 05:51 PM
Nope, math.random doesn't even make anything random
Report Abuse
Wunder_Wulfe is online. Wunder_Wulfe
Joined: 13 Sep 2016
Total Posts: 8356
22 Apr 2017 06:00 PM
math.randomseed( tick() )
math.random()

--should clear up results after getting that first ugly one out of the way
Report Abuse
Previous Thread :: Next Thread 
Page 1 of 1
 
 
ROBLOX Forum » Game Creation and Development » Scripters
   
 
   
  • About Us
  • Jobs
  • Blog
  • Parents
  • Help
  • Terms
  • Privacy

©2017 Roblox Corporation. Roblox, the Roblox logo, Robux, Bloxy, and Powering Imagination are among our registered and unregistered trademarks in the U.S. and other countries.



Progress
Starting Roblox...
Connecting to Players...
R R

Roblox is now loading. Get ready to play!

R R

You're moments away from getting into the game!

Click here for help

Check Remember my choice and click Launch Application in the dialog box above to join games faster in the future!

Gameplay sponsored by:
Loading 0% - Starting game...
Get more with Builders Club! Join Builders Club
Choose Your Avatar
I have an account
generic image