Jump to content
EN
Play

Forum

Randomness and Containers


alkyng
 Share

Recommended Posts

Hi hello guys..

We all know about Random generators sites, and how they're very prevalent and most of us have used one of them and maybe some are using them everyday, and definitely we're using this in Tanki Online ALOT.

Ok, one of the many things that are really baffles me from ages, and made me think alot about, is how Random generators work!! I asked myself, how they teach the computer to choose a random number. I imagine myself as a developer and want to implement this feature what I have to do?

I don't talk about its easiness in program languages like HTML5 you write <random> and they generate a random for you. I talk about the one who implemented it firstly.

Ok, I haven't searched about it as I know I wont find an answer and I just chose to stop overthinking about it as I said there are many complicated things and I don't have to ask about, developers knows better. BTW, past year, this question came to me again and baffled me more. And I decided that I will search everywhere to find the answer and I wont ever stop before I find how¿

Luckily from the first trying I found a big article infront of my face in first Google result. I was lazy to read at the time, but I forced myself as it's the answer of my horrible question. Honestly I became strongly happy after I saw the article is big and I was about to close it, because basically it was enough for me to know that this is a complicated thing and I was right. But I decided to read for further benefits.

Ok, It appeared as it was not an easy to teach the computer to choose a random thing. There is NO code or way to tell the computer that. But the websites are depending on many variants to generate a random. In example the most popular website for randomness is depending on the noise in atmosphere, which is changing quickly. And some of them are depending in example in how many clicks you messed with keyboard. Or how many FPS you have, etc...

Wohoo, stopped my thinking and became happy with the answer. For a human you can easily choose a random number from one to million in example I generated now 472418, and I can give you infinity randoms, but how the computer?

In Tanki (and games) there are many randoms, for every shot you fire you're generating a new probable to land Critical. Or in the Containers..

Edited by asem.harbi

Share this post


Link to post
Share on other sites

In short, there is no "random" numbers in the world of computer science and it is impossible to do so. For those "random" numbers generated by computers, We call it "pseudo random" number, because it is not actually random.

 

The actual implementation of it varies and can get very complicated. It involves seeds and timestamp and all sort of stuff. If you have no idea what I'm talking about, then I suggest you search it online. However, there are different algorithm to generate pseudo random numbers, and each of them have different degree of "randomness". I.e. the more complicated one tends to generate numbers that are "more random". If you are simply doing 

Math.random()

then yeah, it is not that random.

Share this post


Link to post
Share on other sites

A random sequence of numbers is one where it is impossible to predict what the next number will be based on previously numbers. Computers can't generate truly random sequences - but often, we don't need true randomness. We only need a sequence that seems random - that is, a sequence for which it is very difficult to predict what the next number will be, and a sequence in which it is very difficult to find a pattern in.

For example, suppose we wanted the numbers 0-9 in "random" order. We can generated such a "random" sequence with the relation an+1 = (an + 13) mod 10. We'll use an initial starting value a1 = 5.

a2 = 18 mod 10 = 8

a3 = 21 mod 10 = 1

a4 = 14 mod 10 = 4

a5 = 17 mod 10 = 7

If you continue you will find that the first ten numbers in this sequence are 5, 8, 1, 4, 7, 0, 3, 6, 9, 2 (after that the sequence repeats).

Suppose you only knew the first four numbers of this sequence. If you didn't know what the relation was which was used to generate these numbers, would you be able to predict what the fifth number would be? I wouldn't be able to. This sequence seems random to the average person, because it is difficult for the average person to find a pattern in the sequence, even though a pattern does exist. The algorithm I used was a very simple one, but much more sophisticated algorithms exist for producing such pseudo-random sequences.

I mentioned earlier that computers can't generate truly random sequences. This is actually only half true. It possible for example to construct sequences based on measurements of fluctuations in background radiation. These are probably as close as we can get to true randomness.

Edited by ThirdOnion
  • Like 2

Share this post


Link to post
Share on other sites

4 hours ago, At_Shin said:

I am aware of the story that a set of random numbers cannot be achieved. I think the computers can only be programed to generate a number from a given set of numbers - which would be non-random. For example, Gauss sniper turret has a minimum and maximum damage range - this should be the set of numbers out of which the computer chooses one (which we then see as the damage dealt to the enemy).

I have a good taste and intelligence in choosing the topic title, you not. Why you changed my title? I know my past title was seems some vague, but I think now your title is too official and maybe even people enter the topic think it's an update? "Randomness and Containers" Seems good, Containers is a filler word.

I will return it. EXCEPT if it was really violate the forum rules directly I'm sorry.

Share this post


Link to post
Share on other sites

First thank you for keeping my title and thank you for posting and supporting my topic.

9 hours ago, At_Shin said:

It's in off-topic forum. Why would someone think that it's an update to the game?

It was sarcastic describing how it was incredibly official, Marcus could take your help in his next update

Share this post


Link to post
Share on other sites

This topic is now closed to further replies.
 Share

×
×
  • Create New...