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 » Scripting Helpers
Home Search
 

Re: math.random alternatives

Previous Thread :: Next Thread 
JigglingJack is not online. JigglingJack
Joined: 25 Mar 2014
Total Posts: 11263
06 Apr 2014 12:27 AM
even with seeding, my math.random integer kept on coming out as sequences, just as I thought it would. Are there any other algorithms so I can make an alternative function to math.random?

i'm asian
Report Abuse
cntkillme is not online. cntkillme
Joined: 07 Apr 2008
Total Posts: 44956
06 Apr 2014 12:29 AM
HttpService

random DOT org
Report Abuse
JigglingJack is not online. JigglingJack
Joined: 25 Mar 2014
Total Posts: 11263
06 Apr 2014 12:40 AM
is atmospheric noise actually true (human-like) random?

i'm asian
Report Abuse
wazap is not online. wazap
Joined: 29 Jun 2007
Total Posts: 23234
06 Apr 2014 12:42 AM
BrickColor.Random().r --?
Report Abuse
JigglingJack is not online. JigglingJack
Joined: 25 Mar 2014
Total Posts: 11263
06 Apr 2014 12:45 AM
but isn't random() a PRNG?

i'm asian
Report Abuse
wazap is not online. wazap
Joined: 29 Jun 2007
Total Posts: 23234
06 Apr 2014 12:48 AM
Second alternative: math.floor(tick()*100000)*MAX%1
Report Abuse
JigglingJack is not online. JigglingJack
Joined: 25 Mar 2014
Total Posts: 11263
06 Apr 2014 12:52 AM
what is MAX? math.max?

i'm asian
Report Abuse
wazap is not online. wazap
Joined: 29 Jun 2007
Total Posts: 23234
06 Apr 2014 12:57 AM
I did that one horribly

function altRandomNum(min, max, integers)
local num = math.floor(tick()*1000000)*(max-min)+min
if integers then
num = num%1
end
return num
end
Report Abuse
JigglingJack is not online. JigglingJack
Joined: 25 Mar 2014
Total Posts: 11263
06 Apr 2014 01:01 AM
that's basically what i'm doing right now, except that the number keeps on coming out in sequences

i do a number between 1,4

it goes
1,1,1,1,3,3,3,3, 2,4,1,4,2,1,3,4,1,3 something like that

i'm asian
Report Abuse
JigglingJack is not online. JigglingJack
Joined: 25 Mar 2014
Total Posts: 11263
06 Apr 2014 01:09 AM
bump
I know tick() is a physical phenomenon but is it really going to generate random? it's just a time ever since unix right? Why would that generate random? I was thinking more thermal noise and atmospheric noise for random

i'm asian
Report Abuse
cntkillme is not online. cntkillme
Joined: 07 Apr 2008
Total Posts: 44956
06 Apr 2014 01:10 AM
Anytime you are using a computer you are always going to get some sort of sequence.
Report Abuse
JigglingJack is not online. JigglingJack
Joined: 25 Mar 2014
Total Posts: 11263
06 Apr 2014 01:11 AM
yes, but on the random.org, it didn't come up with as SIGNIFICANT of a sequence

i'm asian
Report Abuse
cntkillme is not online. cntkillme
Joined: 07 Apr 2008
Total Posts: 44956
06 Apr 2014 01:30 AM
Because it's not computer generated.
random DOT org/randomness/
Report Abuse
JigglingJack is not online. JigglingJack
Joined: 25 Mar 2014
Total Posts: 11263
06 Apr 2014 01:32 AM
I know it's generated via atmospheric noise but I was going to use thermal noise originaly
but isn't tick() also a natural thing

i'm asian
Report Abuse
cntkillme is not online. cntkillme
Joined: 07 Apr 2008
Total Posts: 44956
06 Apr 2014 01:34 AM
No, tick is just the time since Jan. 1 1960.
That's not natural, it's literally just doing 1, 2, 3, 4, ..., now
Report Abuse
JigglingJack is not online. JigglingJack
Joined: 25 Mar 2014
Total Posts: 11263
06 Apr 2014 01:43 AM
so why do they use that for the seed

i'm asian
Report Abuse
cntkillme is not online. cntkillme
Joined: 07 Apr 2008
Total Posts: 44956
06 Apr 2014 01:44 AM
Because it's always increasing, it will never be the same again.
Report Abuse
JigglingJack is not online. JigglingJack
Joined: 25 Mar 2014
Total Posts: 11263
06 Apr 2014 01:50 AM
prng is stupid

i'm asian
Report Abuse
cntkillme is not online. cntkillme
Joined: 07 Apr 2008
Total Posts: 44956
06 Apr 2014 01:53 AM
But it's fast I guess
Report Abuse
JigglingJack is not online. JigglingJack
Joined: 25 Mar 2014
Total Posts: 11263
06 Apr 2014 01:58 AM
wait, TRNG's are slower? I've heard that the Blum Blum Shub algorithm for PRNG's are slow too though

i'm asian
Report Abuse
JigglingJack is not online. JigglingJack
Joined: 25 Mar 2014
Total Posts: 11263
06 Apr 2014 01:59 AM
...well not algorithm
i should say
blum blum shub generator that IS a prng

i'm asian
Report Abuse
cntkillme is not online. cntkillme
Joined: 07 Apr 2008
Total Posts: 44956
06 Apr 2014 02:02 AM
TRNG's are dependent on what is actually being measured while PRNG need no physical "input" meaning the speed of the TRNG depends on the object that is being measured.
Report Abuse
JigglingJack is not online. JigglingJack
Joined: 25 Mar 2014
Total Posts: 11263
06 Apr 2014 02:07 AM
what prng does roblox use? Mersenne?

i'm asian
Report Abuse
JigglingJack is not online. JigglingJack
Joined: 25 Mar 2014
Total Posts: 11263
06 Apr 2014 02:09 AM
ya, i just found out that regular Lua uses Mersenne twister so probably roblox lua does too.
I really don't know what to use now because each side has it's benefits.
I think it's time to play around with TestU01 and take the big choice

i'm asian
Report Abuse
cntkillme is not online. cntkillme
Joined: 07 Apr 2008
Total Posts: 44956
06 Apr 2014 02:35 AM
Rbx.Lua definitely uses what Lua uses, afaik they haven't changed any actual core functions (all of the functions in the math table and stuff like that)
Report Abuse
Previous Thread :: Next Thread 
Page 1 of 1
 
 
ROBLOX Forum » Game Creation and Development » Scripting Helpers
   
 
   
  • 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