spinywindJoin Date: 2012-01-26 Post Count: 3580 |
math.random() is not random so.. and math.randomseed(tick()) isnt either.
|
|
SoybeenJoin Date: 2010-02-17 Post Count: 21462 |
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. |
|
spinywindJoin Date: 2012-01-26 Post Count: 3580 |
if i wanted to generate a random number 1,10 how would I do it without math.random()?
|
|
Dollar500Join Date: 2013-01-12 Post Count: 504 |
Nothing is random |
|
libpngJoin Date: 2017-09-03 Post Count: 20 |
"if i wanted to generate a random number 1,10 how would I do it without math.random()?"
Custom RNG or a web service. |
|
|
Find a online ###### counter and use httpservice to get numbers |
|
|
gryphunk2Join Date: 2013-03-04 Post Count: 10872 |
u can't
the closest possible thing is math.randomseed(tick())
heccled by the master heccler again |
|
SoybeenJoin Date: 2010-02-17 Post Count: 21462 |
@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. |
|
OzzyFinJoin Date: 2011-06-07 Post Count: 3600 |
lavalamps are great |
|
JoshRBXJoin Date: 2012-05-19 Post Count: 8778 |
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 |
|
|
|
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. |
|
|
"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.
|
|
cabblerJoin Date: 2015-06-19 Post Count: 735 |
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)) |
|
SoybeenJoin Date: 2010-02-17 Post Count: 21462 |
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. |
|
|
https://www.youtube.com/watch?v=9rIy0xY99a0
thank me later |
|
nixpcJoin Date: 2012-02-05 Post Count: 15425 |
Nothing is random so: no |
|
Dollar500Join Date: 2013-01-12 Post Count: 504 |
@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 |
|
SoybeenJoin Date: 2010-02-17 Post Count: 21462 |
Wellllll the 4th dimension is time, and that's well established, soooo, no. |
|
|
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.
|
|
mattscyJoin Date: 2011-05-06 Post Count: 1079 |
we are all part of a simulation |
|
SoybeenJoin Date: 2010-02-17 Post Count: 21462 |
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 |
|
|
Nothing is random. math.random() is pseudorandom |
|
SoybeenJoin Date: 2010-02-17 Post Count: 21462 |
Stop saying that nothing is random.
Do your research. |
|