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: Math.random not random?

Previous Thread :: Next Thread 
misterhup is not online. misterhup
Joined: 07 Jul 2010
Total Posts: 280
17 Jan 2016 01:26 PM
Is it just in studio or mmath.random isnt random at all? If so, can you guys help me figutre out a function to get a random element from a table?


Report Abuse
ColonySimulator is not online. ColonySimulator
Joined: 05 Jul 2015
Total Posts: 1721
17 Jan 2016 01:54 PM
It's random , you maybe just get the same thing over again and again and you are maybe really lucky xD
Report Abuse
LongKillKreations is not online. LongKillKreations
Joined: 14 Feb 2014
Total Posts: 4502
17 Jan 2016 01:55 PM
You can set a seed with math.randomseed(x), which will set x as the seed for the pseudo-random generator.
Report Abuse
deadlyfox43110 is not online. deadlyfox43110
Joined: 09 Oct 2009
Total Posts: 1823
17 Jan 2016 01:58 PM
math.randomseed(tick())
is what you want
Report Abuse
misterhup is not online. misterhup
Joined: 07 Jul 2010
Total Posts: 280
18 Jan 2016 09:54 AM
I don't really know how to use it.. Can you give me an example? For example if I have a table "abc={"a","b","c"}" how do I get a random element out of it using "math.randomseed"?


Report Abuse
chimmihc is not online. chimmihc
Joined: 01 Sep 2014
Total Posts: 17143
18 Jan 2016 10:18 AM
http://www.lua.org/pil/18.html

https://en.wikipedia.org/wiki/Pseudorandomness


Report Abuse
misterhup is not online. misterhup
Joined: 07 Jul 2010
Total Posts: 280
18 Jan 2016 12:37 PM
I'm dumb...Can I just get the example?


Report Abuse
nox7 is not online. nox7
Joined: 29 Aug 2008
Total Posts: 27467
18 Jan 2016 12:40 PM
This usually happens if you're testing repeatedly over and over in studio. We used to fix this back in the old days by doing this at the top:

math.random();math.random();math.random();

It calls and reseeds itself a bit before use. Fixes your issue.
Report Abuse
misterhup is not online. misterhup
Joined: 07 Jul 2010
Total Posts: 280
18 Jan 2016 12:41 PM
Thanks. It seems to work!


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