Note that there are some explanatory texts on larger screens.

plurals
  1. PO
    primarykey
    data
    text
    <p>The first thing to consider is how you are using the numbers. Flipping lots of coins will give a pretty good 50/50 split, where flipping two or three coins is apt to give you an annoying non-apparent-random 3 heads or tails too much of the time. Rolling lots of dice looking for ones will give very uneven results, sometimes with no ones at all and sometime with half the dice being ones. Rolling lots more dice will help here. Generally, the more numbers you generate, the happier people will be with them.</p> <p>If you're only generating a few numbers, I'd start with truly random ones, see what annoys you, and fix it. One simple thing to do is reduce the odds of a number coming up based on how often it has come up before. Or even more simply, don't return the same number twice. But there are often subtleties. If you are returning numbers 1 through 10, but 1-4 count one way and 5-10 the other, a sequence of 123451234512345 will be very annoying (80% low, 20% high). If the ranges are 1-2 and 3-10 it would not be (you get the expected 40% low, 60% high). Worse, if you have competetive die rolls, it's the relative results that matter. The numbers from each die may look, on their own, to be random, but if, 9 times out of 10, one die rolls higher than the other, the dice will seem loaded.</p> <p>There's a lot more like this. If someone is playing a game where they roll a die to see how far they move, then roll to see how much money they get, a set of rolls that would be psychologically random on their own can give someone no moves and tons of money, or vice versa, and seem seriously rigged.</p> <p>So I'd generate a random number, or set of numbers, and then reject them if they don't look random enough in that particular case. (You may want to reject it some percentage of the time, or else you may be giving up randomness completely.) (If you're clever, you can adjust the odds in advance and on the fly to minimize the number of regenerations you have to do.) There isn't really a general solution to this problem.</p> <p><em>Actually</em>, I <em>can</em> think of two general solutions. One is: just don't use random numbers. The other is to generate vast quantities of them and don't let anyone look at the details of the sequence. If you have a game with 5000 soldiers on each side shooting at each other with a 10% chance of hitting, the overall effect (486 down on one side and 512 down on the other) will be very psychologically random. Just don't let anyone look at the results of, say, 10 individual shots. ("I had 30 shots and not a single hit!" "He had 3 hits in 5 shots!")</p> <p><strong>Also:</strong> I wrote the above, then realized there might be an ethical issue here. If you are generating a random map, or doing lots of other things, rigging the results of random number generation can be a very good idea. However, a player in a game may have a right to a real random number. If you have a poker game, and a real random deal gives a player a royal flush, your program has no business deciding that that's too extreme and redealing. A war game player deciding to make an attack with a supposed 50-50 chance of success should not be blindsided by the fact that, because previously he has won 3 50-50 contests in a row, his real odds are now only 20-80. The ethics aspect here could probably fill a book which I don't have time to write, but be very aware of it.</p>
    singulars
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. VO
      singulars
      1. This table or related slice is empty.
    2. VO
      singulars
      1. This table or related slice is empty.
    3. VO
      singulars
      1. This table or related slice is empty.
    1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload