Problem with Random

RUPASRUPAS Member Posts: 823
edited May 2012 in Working with GS (Mac)
hi all, I have a small problem with the random, I'm making a game with boards, a trivial, I have 200 questions and random, the probability of a recurrence is 0.00025 and yet are repeated a lot, do not understand, there is some how to improve this problem?

Comments

  • JustMe74JustMe74 Member, PRO Posts: 542
    Why not just use attributes to store when a question has been asked, and if it has already been asked, don't ask it again? Maybe clear those attributes every x seconds if you don't mind repeats (but just want less frequent repeats) ?
  • rabbigarfinkelrabbigarfinkel Member Posts: 39
    I would just wait for writable tables. Then you'll be able to delete questions from the table after they are asked. Writable tables are supposed to be released in .9.9.93 this week.
  • hotMagichotMagic Member, PRO Posts: 266
    You can tend to get that if you just use plain random. Sometimes you get better results if you do something like random(game.milliseconds)%5
    That way you avoid things like, if you start a level twice, the first thing you seed being the same.
  • RUPASRUPAS Member Posts: 823
    Thanks all!

    I have this rule:

    "change atribute game.whatquestion to random(1,tablerowcount(game.TBPACKQUESTION)"

    is correct?

    this pack contains 200 questions, but repeats much,

    some help?
  • hotMagichotMagic Member, PRO Posts: 266
    That sounds good, but I was saying above, just to really get it random, something like this (and forgive me i don't have GS open, so it's not exact)

    random(1, game.milliseconds)%tablerowcount(game.TBPACKQUESTION)

    That way you are getting a random from the game timer which is all over the place, then the % allows you to constrain it to how many questions you have. Like 200 for example.

    If you just make a test game with a blank square that shows the results of that formula, and have it do that whenever you click it, you'll probably see some really random selections.
  • RUPASRUPAS Member Posts: 823
    edited May 2012
    any help? I prove random(1, game.clock.milliseconds)%tablerowcount(game.TBPACKQUESTION) but no is correct
  • MotherHooseMotherHoose Member Posts: 2,456
    edited May 2012
    @Rupas … use the new read/write tables in .93
    create/import the original table
    create a blank Table for runTime usage

    gameAttribute: index type … name: what? … this will be your row #

    Copy Table behavior … original to temp
    use the Add/Remove behavior to delete used rows in the temp table

    demo: http://www.mediafire.com/?48p8lxzho7kgrm2

    image MH
  • RUPASRUPAS Member Posts: 823
    @MotherHoose yes I use, but my game is a quiz, if I delete the rows can not play again, or if you can?
  • RUPASRUPAS Member Posts: 823
    oh yes, I think I understand I will try
  • MotherHooseMotherHoose Member Posts: 2,456
    @Rupas … good you got it! … with the incomplete directions (now edited)

    for restart or replay have a button that changes the what? to 0
    then copies the original to temp

    image MH
Sign In or Register to comment.