jasondee1
|
  |
| Joined: 26 Jul 2008 |
| Total Posts: 8002 |
|
|
| 21 May 2014 08:14 AM |
So I was messing around with tables and I found this method called table.sort
soo.... I mashed it together with math.random and it throws up 5 random numbers that are almost never the same
math.randomseed(tick()) while true do wait(1) t = {""..math.random(1,100), ""..math.random(1,100), ""..math.random(1,100), ""..math.random(1,100), ""..math.random(1,100)} table.sort(t) print(table.concat(t, ' ')) end
Does anybody have a random gen they want to share?
it could be a contest >:D |
|
|
| Report Abuse |
|
|
|
| 21 May 2014 08:51 AM |
| Find yourself a quantum computer. |
|
|
| Report Abuse |
|
|
jasondee1
|
  |
| Joined: 26 Jul 2008 |
| Total Posts: 8002 |
|
|
| 21 May 2014 09:32 AM |
even more random C: I just figured out the key to a completely random, non looping player picker, this works better than using math.randomseed.
table.sort(c, function(a,b) return math.random(1, game.Players.NumPlayers) end) |
|
|
| Report Abuse |
|
|
| |
|
jasondee1
|
  |
| Joined: 26 Jul 2008 |
| Total Posts: 8002 |
|
| |
|
|
| 21 May 2014 09:41 AM |
| you don't really need to bother getting stuff 'more random' and you can't have truly random numbers |
|
|
| Report Abuse |
|
|
jasondee1
|
  |
| Joined: 26 Jul 2008 |
| Total Posts: 8002 |
|
|
| 21 May 2014 09:45 AM |
You do when you have a game script that constantly chooses the same player over and over again.
I felt niklis's pain when the sheriff was the murderer in some games |
|
|
| Report Abuse |
|
|
|
| 21 May 2014 09:50 AM |
whot? then just do a check to see if its the same player as last time, and if it is, choose a different player
and dont touch math.randomseed() |
|
|
| Report Abuse |
|
|
jasondee1
|
  |
| Joined: 26 Jul 2008 |
| Total Posts: 8002 |
|
|
| 21 May 2014 09:55 AM |
I tried that myself and you know what happened?
it started to loop, kept choosing the same player both times, then when I messed with randomseed() it just chose the same players every round, math.random doesn't differ when it starts, only as it progresses, which is a problem when it is restarted. |
|
|
| Report Abuse |
|
|
Oysi
|
  |
| Joined: 06 Jul 2009 |
| Total Posts: 9058 |
|
|
| 21 May 2014 09:57 AM |
| This is a joke, right? All you're doing is using Lua's random stuff, and you're even doing it wrong. And then you also use the table.sort thingy wrong. Plus, random isn't defined by several numbers not being alike. |
|
|
| Report Abuse |
|
|
jasondee1
|
  |
| Joined: 26 Jul 2008 |
| Total Posts: 8002 |
|
|
| 21 May 2014 10:02 AM |
| that's not what I'm doing at all there, I'm sorting the random numbers randomly, you can see that table.sort isn't defined right? and a few replies back I posted a edit to the script so it could apply to a truly random player. |
|
|
| Report Abuse |
|
|
jasondee1
|
  |
| Joined: 26 Jul 2008 |
| Total Posts: 8002 |
|
|
| 21 May 2014 10:04 AM |
(cont..) so It could be applicable in a "player picking function". When table.sort isn't defined, it just does it by order.
Here, its 'more random' now:
math.randomseed(tick()) while true do wait(1) t = {""..math.random(1,100), ""..math.random(1,100), ""..math.random(1,100), ""..math.random(1,100), ""..math.random(1,100)} table.sort(t, function(a,b) return math.random(1,100) end) print(table.concat(t, ' ')) end |
|
|
| Report Abuse |
|
|
jasondee1
|
  |
| Joined: 26 Jul 2008 |
| Total Posts: 8002 |
|
|
| 21 May 2014 10:05 AM |
| when table.sort's order isnt defined, I meant |
|
|
| Report Abuse |
|
|
|
| 21 May 2014 10:30 AM |
| Completely true random numbers cannot be generated by computers. Not even hypercomputers. However with utilizing atmospheric noise you can get pretty close, research it |
|
|
| Report Abuse |
|
|
|
| 21 May 2014 03:02 PM |
"I felt niklis's pain when the sheriff was the murderer in some games"
if player.Murderer.Value == true then table.remove etc |
|
|
| Report Abuse |
|
|
morash
|
  |
| Joined: 22 May 2010 |
| Total Posts: 5834 |
|
|
| 21 May 2014 03:07 PM |
function random(maxWait) return math.floor(math.floor(tick())/wait())%(maxWait+1) end
:) Seems random enough. |
|
|
| Report Abuse |
|
|
magnalite
|
  |
| Joined: 18 Oct 2009 |
| Total Posts: 2467 |
|
|
| 21 May 2014 03:26 PM |
| The amount of silly people in here thinking they know stuff about randomness is too damn high. |
|
|
| Report Abuse |
|
|
|
| 21 May 2014 04:28 PM |
@TheEvilComputer,
just because you have a quantum computer does not mean its random number generator has a different core-architecture than others.
@Post, there really is not such thing as complete randomness. The only way to get something completely random is if it was defiant of the laws of 'chance'- which in itself is a self defiant randomness. Really your best option is math.random() for the most natural result.
By definition beating the laws of chance is defiant of randomness, but since randomness is aligned with 'chance' you can't really get a true 'random' result anywhere. |
|
|
| Report Abuse |
|
|
bowman6
|
  |
| Joined: 06 Jul 2008 |
| Total Posts: 233 |
|
|
| 21 May 2014 05:16 PM |
"most Natural Result"
I think by definition because all randomness must be observed either by writing it down, throwing stones into pots, or storing it in a table, it is inherently not natural, but artificial. There is no degree of Natural-ness as an object is or is not since the definition of natural is that it is no part artificial. |
|
|
| Report Abuse |
|
|
bowman6
|
  |
| Joined: 06 Jul 2008 |
| Total Posts: 233 |
|
|
| 21 May 2014 05:17 PM |
| must be observed by method such as:* |
|
|
| Report Abuse |
|
|
|
| 21 May 2014 05:20 PM |
im say you will get a natural "result", and randomness is not native to the thoughts of man kind.
you can find random occurrences in nature, whether it be with biological sciences, quantum mechanics, or anomaly, randomness is in no way a invention. Its a observation that we vocalize in things like math.random() through mathematical representation. |
|
|
| Report Abuse |
|
|
|
| 21 May 2014 05:24 PM |
you also neglect the idea that there are different things you can infer from the word 'natural'
for instance, when someone asks a question and another replies with 'naturally', or 'naturalich'(german) they are referring to a a normality. |
|
|
| Report Abuse |
|
|
bowman6
|
  |
| Joined: 06 Jul 2008 |
| Total Posts: 233 |
|
|
| 21 May 2014 05:24 PM |
If we observe a series of natural occurrences, there is no way to label it a natural series of randomness because it required human observation to define it.
Now, if you're arguing the statement:
There is natural randomness in the world.
Then I could not refute you because as humans, by definition, we cannot observe a series of randomness and dub it natural by the fact that observation is always going to be an artificial process. |
|
|
| Report Abuse |
|
|
bowman6
|
  |
| Joined: 06 Jul 2008 |
| Total Posts: 233 |
|
|
| 21 May 2014 05:26 PM |
The word you're looking for that would be more appropriate then would be 'Realistic Randomness'.
This would express not that the randomness shown is natural, but like whatever natural occurrence it is emulating. |
|
|
| Report Abuse |
|
|
|
| 21 May 2014 05:31 PM |
by your logic, humans would need to record randomness for an anomaly to be random. That of itself is illogical, if something is 'random' (whether its expressed through a specific word for humans to construe an idea or not) it will be random without humans.
Definition: "made, done, happening, or chosen without method or conscious decision"
Him doing nothing, and getting a result is 'random'- he could say math.random() and because there is no procedural methodology behind it, it is therefor random.
|
|
|
| Report Abuse |
|
|