How to implement roulette?

Was wondering how all these roulette sites, as well as how all of this is protected from substitution.

A trivial example is the generated array of values.
For example, we have unique values:
items = [1, 2, 3, 4, 5, 6, 7, 8, 9, 10]
From them we form a unique array of values for the game:
items_for_game = [3, 4, 4, 7, 1, 9, 10, 1, 4, 7, 6, 2, 9, 8, 2, 2, 10, 3, 6, 4 6, 4, 8, 9, 10, 4, 3, 6, 2, 4]


On the website of them formed by the horizontal tape. Moreover, cyclical. This tape consists of a hidden user group:
<input type="radio" name="items" value="here's a number from the array above">

On clicking the button the tape starts to turn.
From the starting speed every second subtracted some value, and stopping the tape.

And at this stage is brewing three major issues:
1. How to implement the scrolling strip? After all, a simple slide here obviously do not? Or is this a banal slide?
2. For example, the first item sorted out. How to identify an element? I mean how to identify the selected item? For example, the selected is the one element that was at the center of the block after stopping the tape.
3. How to get rid of fraud? I understand that everything is in HTML code can easily edited by the user. Including the ID of the radio input. Hence there is no desire to use the input radio - this is no longer necessary. In short, the third item is closely linked with the second. How to implement it?

I can assume that instead of an array items_for_game we create an object items_for_game, with keys from 0 to N. Then get a random number element, which drives the stop band (it is not: "From the starting speed every second subtracted some value, and stopping the tape.").

In General, the experts, what do you say? :)
July 9th 19 at 10:32
3 answers
July 9th 19 at 10:34
The server issues a picture id and he decides what number will drop out, and twist it for beauty...
But as it is torsion then implemented, because the tape must stop at pre-selected ID?

That is on the server side is formed and the tape itself, in the right place is inserted the right number?
Every second is calculated and then reduced speed, that would be a rate of zero was the place where pre-selected ID? - alfonzo.Zeml commented on July 9th 19 at 10:37
Although...

I sites visit is already formed tape before it runs.

The question about stopping the tape at pre-selected element while I is not clear. - alfonzo.Zeml commented on July 9th 19 at 10:40
: Just about. Curls a little... sometimes it is noticeable =) - nannie72 commented on July 9th 19 at 10:43
July 9th 19 at 10:36
1. the server provides the desired number,
2. roulette spins to max and begins to rotate at maximum speed (it is even possible that very slow - it does not matter),
3. the animation of the braking is positioned on the desired degree of closed wheels so that at the time of the stop fell (how-to))) the desired number (which is issued to the server), and since then, the roulette begins to slow to a stop on the formula, getting right on that number.
4. Honesty: generating a series of numbers along with the tail of hair loss, the hash of this sequence with the "salt", the output of the hash and the length of the series (number of spins) to the beginning of the game. After a series of spins at a screening of "salt" and the whole series of numbers, so that people could check at the public, known to all the hash formula.
July 9th 19 at 10:38
The main question "How to get rid of fraud?"
The answer is that all decisions have to take the server and only on the basis of reliable data (which can only be modified by the server itself).
The rest is implementation details of the interface.
And even in this case, you can find weaknesses, if you try, for example, the dependence of numbers of the current time.

Find more questions by tags AlgorithmsjQueryJavaScript