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
|
  |
| 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
|
  |
| 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
|
  |
| Joined: 12 Jan 2013 |
| Total Posts: 504 |
|
| |
|
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 |
|
|
|
| 03 Dec 2017 12:22 AM |
| Find a online ###### counter and use httpservice to get numbers |
|
|
| Report Abuse |
|
|
| |
|
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
|
  |
| 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
|
  |
| Joined: 07 Jun 2011 |
| Total Posts: 3600 |
|
| |
|
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 |
|
|
| |
|
|
| 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 |
|
|
|
| 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
|
  |
| 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
|
  |
| 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 |
|
|
|
| 03 Dec 2017 07:43 AM |
https://www.youtube.com/watch?v=9rIy0xY99a0
thank me later |
|
|
| Report Abuse |
|
|
nixpc
|
  |
| Joined: 05 Feb 2012 |
| Total Posts: 15425 |
|
| |
|
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
|
  |
| 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 |
|
|
|
| 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
|
  |
| Joined: 06 May 2011 |
| Total Posts: 1079 |
|
|
| 03 Dec 2017 08:38 AM |
| we are all part of a simulation |
|
|
| Report Abuse |
|
|
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 |
|
|
|
| 03 Dec 2017 08:39 AM |
| Nothing is random. math.random() is pseudorandom |
|
|
| Report Abuse |
|
|
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 |
|
|