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 there a way to truly generate a random number?

Previous Thread :: Next Thread 
spinywind is not online. spinywind
Joined: 26 Jan 2012
Total Posts: 3580
02 Dec 2017 11:26 PM
math.random() is not random so.. and math.randomseed(tick()) isnt either.


Report Abuse
Soybeen is not online. Soybeen
Joined: 17 Feb 2010
Total Posts: 21462
02 Dec 2017 11:31 PM
Depends on how you define random. Beyond your capacity to anticipate? In that sense there are a lot of random things, like the weather.

As for "true random", the noise at the edge of the universe is pretty random. We haven't found any patterns in it.
Report Abuse
spinywind is not online. spinywind
Joined: 26 Jan 2012
Total Posts: 3580
02 Dec 2017 11:33 PM
if i wanted to generate a random number 1,10 how would I do it without math.random()?


Report Abuse
Dollar500 is not online. Dollar500
Joined: 12 Jan 2013
Total Posts: 504
02 Dec 2017 11:36 PM
Nothing is random
Report Abuse
libpng is not online. libpng
Joined: 03 Sep 2017
Total Posts: 20
03 Dec 2017 12:11 AM
"if i wanted to generate a random number 1,10 how would I do it without math.random()?"

Custom RNG or a web service.
Report Abuse
VineyardVine is not online. VineyardVine
Joined: 20 Nov 2010
Total Posts: 904
03 Dec 2017 12:22 AM
Find a online ###### counter and use httpservice to get numbers
Report Abuse
VineyardVine is not online. VineyardVine
Joined: 20 Nov 2010
Total Posts: 904
03 Dec 2017 12:24 AM
######
Report Abuse
gryphunk2 is online. gryphunk2
Joined: 04 Mar 2013
Total Posts: 10872
03 Dec 2017 12:27 AM
u can't
the closest possible thing is math.randomseed(tick())


heccled by the master heccler again
Report Abuse
Soybeen is not online. Soybeen
Joined: 17 Feb 2010
Total Posts: 21462
03 Dec 2017 03:13 AM
@Dollar500
That's not something you should be so eager to believe.

True randomness does not exist in classical physics where randomness is necessarily a result of forces that may yet be unknown, but exist. The quantum world, however, is intrinsically truly random.
Report Abuse
OzzyFin is not online. OzzyFin
Joined: 07 Jun 2011
Total Posts: 3600
03 Dec 2017 03:22 AM
lavalamps are great
Report Abuse
JoshRBX is not online. JoshRBX
Joined: 19 May 2012
Total Posts: 8778
03 Dec 2017 04:50 AM
whats wrong with

math.randomseed(tick()) once at the top of your code
and then
math.random(10)

also if thats not good enough for whatever reason, try random . org
Report Abuse
128Gigabytes is not online. 128Gigabytes
Joined: 17 Apr 2014
Total Posts: 3616
03 Dec 2017 05:18 AM
Nothing is random x2
Report Abuse
Flubberlutsch is not online. Flubberlutsch
Joined: 27 Sep 2016
Total Posts: 188
03 Dec 2017 05:35 AM
We all know the issues of math.random(), but there's a simple way to prevent it: Just preheat the RNG lol.

E.g.

function rng(min,max)
if max then return math.random(min,max) elseif min then return math.random(min) else return math.random() end
end
function random(min,max)
math.randomseed(os.time())
for i=1,1000 do rng(min,max) end
return rng(min,max)
end

This will work exactly the same as the math.random() function, meaning no parameters = random number from 0 to 1, one parameter = random integer from 1 to max, two parameters = random integer from min to max.

Also, using tick() with randomseed is bad practice since the RNG uses tick in a way to calculate the random number. This would result in the same random number multiple times in a row.

Keep in mind: Some things like DataStore actions (SetAsync, GetAsync, etc) and similar reset the randomseed and pulling an RNG request after such a thing will always return the same number. Use the function above to get a truly random number lol.
Report Abuse
JarodOfOrbiter is not online. JarodOfOrbiter
Joined: 17 Feb 2011
Total Posts: 20029
03 Dec 2017 06:37 AM
"The quantum world, however, is intrinsically truly random."
That's what they say, but why is it? In a universe that has until the past twenty years been governed solely by strict and definable laws, it's hard to comprehend how something can be truly random. I'll never say it isn't truly random. But I will say that there can always be something we're missing.


Report Abuse
cabbler is not online. cabbler
Joined: 19 Jun 2015
Total Posts: 735
03 Dec 2017 06:50 AM
You can do a GetAsync to site random org. But algorithms are good enough for me ... someone posted this before and i'll share it:

math.randomseed(tick()%1 * 1e7) print(math.random(10))
Report Abuse
Soybeen is not online. Soybeen
Joined: 17 Feb 2010
Total Posts: 21462
03 Dec 2017 07:05 AM
To think that anybody knows enough to say in confidence "there's no such thing as random" is ridiculous. 😅
The idea of predetermined fate and that "nothing is random" is kind of silly to even bother yourself with, considering the scope of humanity's understanding about.. anything.

Also, how is seeding that on os.time() different than seeding with tick() besides that os.time() returns integers? If anything, isn't os.time() a worse candidate considering its consistency?

From what I understand, seeding on tick() is not bad practice unless you know something about the source code for randomseed() that I don't. Seeding on the current time is how I see it done almost exclusively, and I've never had an issue with numbers appearing back-to-back unless I'm running it tens of thousands of times per second.
Report Abuse
Spectrum555 is not online. Spectrum555
Joined: 20 Jul 2010
Total Posts: 171
03 Dec 2017 07:43 AM
https://www.youtube.com/watch?v=9rIy0xY99a0


thank me later
Report Abuse
nixpc is not online. nixpc
Joined: 05 Feb 2012
Total Posts: 15425
03 Dec 2017 07:44 AM
Nothing is random so: no
Report Abuse
Dollar500 is not online. Dollar500
Joined: 12 Jan 2013
Total Posts: 504
03 Dec 2017 07:53 AM
@Soybeen
I believe that the quantum world is just particles in the 4th dimension popping into existence in our demension, so it seems as if it is random. String theory says this...

@Jarod
Exactly
Report Abuse
Soybeen is not online. Soybeen
Joined: 17 Feb 2010
Total Posts: 21462
03 Dec 2017 08:15 AM
Wellllll the 4th dimension is time, and that's well established, soooo, no.
Report Abuse
JarodOfOrbiter is not online. JarodOfOrbiter
Joined: 17 Feb 2011
Total Posts: 20029
03 Dec 2017 08:34 AM
Welllll the fourth dimension is still up for grabs. It could be time, but that's literally just our perceptions. I disagree with the popping in and out of existence theory, but I also highly disagree with the fourth dimension being time. Time is a dimension, but it doesn't have to be the fourth. Dimensions are, again, up for grabs.


Report Abuse
mattscy is online. mattscy
Joined: 06 May 2011
Total Posts: 1079
03 Dec 2017 08:38 AM
we are all part of a simulation
Report Abuse
Soybeen is not online. Soybeen
Joined: 17 Feb 2010
Total Posts: 21462
03 Dec 2017 08:39 AM
As far as as the spacetime model is concerned, time is the fourth dimension.

By fourth I don't mean that it comes in a sequence after the 3 spatial dimensions, just that it is one of four required to satisfy spacetime-entrenched theorems and whatnot
Report Abuse
hollowlucas is not online. hollowlucas
Joined: 06 May 2012
Total Posts: 170
03 Dec 2017 08:39 AM
Nothing is random. math.random() is pseudorandom
Report Abuse
Soybeen is not online. Soybeen
Joined: 17 Feb 2010
Total Posts: 21462
03 Dec 2017 08:41 AM
Stop saying that nothing is random.
Do your research.
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