123
-=+=- -=+=- -=+=- -=+=- -=+=- -=+=- -=+=- -=+=- -=+=- -=+=- -=+=- -=+=- -=+=- -=+=- -=+=- -=+=- -=+=- -=+=- -=+=- -=+=- -=+=- -=+=- -=+=- -=+=- -=+=- -=+=- -=+=- -=+=- -=+=- -=+=- (c) WidthPadding Industries 1987 0|291|0 -=+=- -=+=- -=+=- -=+=- -=+=- -=+=- -=+=- -=+=- -=+=- -=+=- -=+=- -=+=- -=+=- -=+=- -=+=- -=+=- -=+=- -=+=- -=+=- -=+=- -=+=- -=+=- -=+=- -=+=- -=+=- -=+=- -=+=- -=+=- -=+=- -=+=-
Socoder -> Blitz -> Why is the Rand() function giving me these results?

Fri, 27 Apr 2007, 16:13
Blitz3Dman
I rewrote my WW entry to tell me how many times it chose each question randomly because it seemed to rarely or never give me some questions and give me some questions quite often. My results for 10,000 randomly picked questions is as follows:


I then wrote a simple program to see if it demonstrated the same fault without anything else going on but instead gave me these results (this program picked a number between 1 and 50 and found 10,000 like the random questions test.):



Program:



And the code to my WW entry:



-=-=-
There are 10 kinds of people in this world -

( Insert 16 remarks about to what extent people know hex here )
Fri, 27 Apr 2007, 16:26
Jayenkai
That's because random is (hopefully!) random..
That is, each number is not chosen because of what's come before. Each number is chosen from the whole selection.

A better thing to do, would be to shuffle the questions, then run through in an order.

That is to take the ordered numbers 1->X, then juggle them about, then start at the first and go through.

IE



BTW : You're giving away the answers, there!


Real-World Explaination of that method, if you need it..
Take 5 cards and lay them out on the table.
Pick up the first, Then pick up any other random card.
Swap them, then put them down in their new places.
Do the same with the rest of the cards in the order they are on the table.
You'll probably move each card a couple of times, but they will definately be shuffled by the time you've finished.
Then for a "Random Selection" just go through in the order they are lying on the table.

-=-=-
''Load, Next List!''
Fri, 27 Apr 2007, 16:39
JL235
I get a nice even spread for the first one.



But I have lots of problems with your questions.

Idigicon did not produce Blitz Basic, they published it. Blitz BASIC (for the Amiga) was produced by Acid Software, who later renamed themselves Blitz Research Labs before producing a new Blitz Basic (for the PC).

Oxygen is not an explosive, although Oxygen canisters will show high explosive warnings. This is because Oxygen as a reactant will create a rapid combustion of any nearby fuels and so may cause an explosion. Although if you put a fire extinguisher in an oven it explodes, I saw that earlier today on TV. But that's to do with pressure, not because it's an explosive.

Tony Hawks Pro Skater 4 was published, not developed, by Activision (to say it's 'by' presumes you mean the developer). It was developed by NeverSoft, as was Tony Hawk's Underground 2. Greenie is by Jayenkai, Hero is the Activision original.

Don't ask how many pages there are in a book. It's a bad question.

'Approximately' would also sound better then 'about' for the maths questions (or 'to 1 decimal place' if you want be more technical).

Jay's suggestion above is very good for randomizing cards.

You could also make an array which is as long as the number of questions you'll be asking. You then iterate along the array picking a random number (which corresponds to a question). Then iterating over all previous array values to check if that number has already been picked. If it has, do pick another number. If it hasn't you store it in the array.

The problem with my example though is that it would be theoretically possible to enter an infinite loop (if you presume that Rand() returns truely random numbers). It'll never happen, but it's possible it might slow down the picking of numbers by a few seconds.
Fri, 27 Apr 2007, 16:54
Blitz3Dman
Picky, picky, picky, you are so picky, diablos

-=-=-
There are 10 kinds of people in this world -

( Insert 16 remarks about to what extent people know hex here )
Fri, 27 Apr 2007, 16:56
JL235
Whilst your just wrong.
Fri, 27 Apr 2007, 17:00
mike_g
He has a point tho. If you are making a game asking questions, you want to make sure the answers are correct.

Oxygen Is not explosive. And in its element sodium reacts with water in an very explosive way. So either answer would be as valid as the other.
Fri, 27 Apr 2007, 17:15
Blitz3Dman
Hm, probably should've put flammable, shouldn't I have

-=-=-
There are 10 kinds of people in this world -

( Insert 16 remarks about to what extent people know hex here )
Fri, 27 Apr 2007, 17:21
JL235
No, because Oxygen isn't flammable. Oxygen helps to promote combustion in other substances, but isn't flammable itself.
Fri, 27 Apr 2007, 17:24
Blitz3Dman
gah, this is pointless

I'll change oxygen to hydrogen, then.

-=-=-
There are 10 kinds of people in this world -

( Insert 16 remarks about to what extent people know hex here )
Fri, 27 Apr 2007, 18:45
power mousey

How are you going to change oxygen to hydrogen??

I'll tell you that Isopropyl is flammable.

en.wikipedia.org/wiki/Isopropyl_alcohol

and that hydrogen is combustible.
look what happened in the Hindenburg disater.

en.wikipedia.org/wiki/Hindenburg_disaster