• umm...

    From Hax0r@VERT/HAX0RQWK to All on Friday, July 13, 2001 21:19:00
    is it just my setup, or does the baja random function seem to be somehow related to screen length/position/buffer (one of them anyways -- not 100%
    sure which one it is, but i'm leaning toward "total lines output")

    ... i found that changing ANSWER.ASC to do a @EXEC:<mybajamodulehere>@, where the baja module generates a random number right of the bat causes the randome number to *always* be the same thing...

    whats the scoop?



    ---
    Synchronet .. hax0r's palace .. you've just been hax0r'd ..
  • From Digital Man@VERT to Hax0r on Saturday, July 14, 2001 18:14:17
    RE: umm...
    BY: Hax0r to All on Sat Jul 14 2001 04:19 am

    is it just my setup, or does the baja random function seem to be somehow related to screen length/position/buffer (one of them anyways -- not 100% sure which one it is, but i'm leaning toward "total lines output")

    ... i found that changing ANSWER.ASC to do a @exec:<mybajamodulehere>@, wher

    whats the scoop?

    I don't know, that's odd. What if the module runs later? What's the number being generated?

    -Rob

    ---
    Synchronet Vertrauen Home of Synchronet [vert/cvs/bbs].synchro.net
  • From Evan Elias@VERT to Hax0r on Sunday, July 15, 2001 06:28:25
    RE: umm...
    BY: Hax0r to All on Sat Jul 14 2001 04:19 am

    is it just my setup, or does the baja random function seem to be somehow related to screen length/position/buffer (one of them anyways -- not 100% sure which one it is, but i'm leaning toward "total lines output")

    ... i found that changing ANSWER.ASC to do a @EXEC:<mybajamodulehere>@, wher

    whats the scoop?

    I've found that random numbers in general seem to be a little goofy in Win32 programs... the first "random" number in general always seems to be the same (even when properly using the timer to randomize things). I have no idea why this happens. In all my win32 programs that I've written, I now do a few dozen dummy calls to the random number function, seems to fix the problem (Shrug?)

    ---
    Synchronet Vertrauen Home of Synchronet [vert/cvs/bbs].synchro.net
  • From Hax0r@VERT/HAX0RQWK to Digital Man on Sunday, July 15, 2001 14:06:00
    RE: umm...
    BY: Digital Man to Hax0r on Sun Jul 15 2001 01:14 am

    I don't know, that's odd. What if the module runs later? What's the number being generated?

    basically i'm having it generate a random number so i can display a random ANSWER screen. it so happens that the random number generated (if no text is on the screen) is *always* zero. If i do a "cls" in the baja module (thus one screen operation), the random number generated is always 1. its just pretty strange. if i run the module after logon (and a lot of screen activity has occured), i always do get a random number...

    any ideas?



    ---
    Synchronet .. hax0r's palace .. you've just been hax0r'd ..
  • From Digital Man@VERT to Hax0r on Sunday, July 15, 2001 15:27:11
    RE: umm...
    BY: Hax0r to Digital Man on Sun Jul 15 2001 09:06 pm

    I don't know, that's odd. What if the module runs later? What's the numbe being generated?

    basically i'm having it generate a random number so i can display a random ANSWER screen. it so happens that the random number generated (if no text i on the screen) is *always* zero. If i do a "cls" in the baja module (thus o screen operation), the random number generated is always 1. its just pretty strange. if i run the module after logon (and a lot of screen activity has occured), i always do get a random number...

    any ideas?

    I don't think the screen line has anything to do with it, but more likely timing. Have you tried doing a small mswait before getting your random number? Or perhaps getting a few random numbers first (as Evan suggested).

    -Rob

    ---
    Synchronet Vertrauen Home of Synchronet [vert/cvs/bbs].synchro.net
  • From Hax0r@VERT/HAX0RQWK to Digital Man on Monday, July 16, 2001 12:22:00
    RE: umm...
    BY: Digital Man to Hax0r on Sun Jul 15 2001 10:27 pm

    I don't think the screen line has anything to do with it, but more likely timing. Have you tried doing a small mswait before getting your random numb Or perhaps getting a few random numbers first (as Evan suggested).

    i tried getting several random numbers in a row -- 5 to be precise, and all were zero. the baja code is fairly simple -- its pasted below. I just took my stock ANSWER.ASC file and replaced the logo/graphic/etc with this:

    (at)EXEC:ANSWER(at)

    then, ANSWER.BIN does this...

    # ANSWER.SRC/ANSWER.BIN
    # random logon screen for synchronet

    cls
    int x

    # seed x with a random number between the fixed range

    random x 3

    compare x 0
    if_equal
    pause_reset
    printfile "%zANSWER1.ANS"
    end_if

    compare x 1
    if_equal
    pause_reset
    printfile "%zANSWER2.ANS"
    end_if

    compare x 2
    if_equal
    pause_reset
    printfile "%zANSWER3.ANS"
    end_if



    ---
    Synchronet .. hax0r's palace .. you've just been hax0r'd ..
  • From Digital Man@VERT to Hax0r on Monday, July 16, 2001 12:03:08
    RE: umm...
    BY: Hax0r to Digital Man on Mon Jul 16 2001 07:22 pm

    RE: umm...
    BY: Digital Man to Hax0r on Sun Jul 15 2001 10:27 pm

    I don't think the screen line has anything to do with it, but more likely timing. Have you tried doing a small mswait before getting your random nu Or perhaps getting a few random numbers first (as Evan suggested).

    i tried getting several random numbers in a row -- 5 to be precise, and all were zero. the baja code is fairly simple -- its pasted below. I just took my stock ANSWER.ASC file and replaced the logo/graphic/etc with this:

    (at)EXEC:ANSWER(at)

    then, ANSWER.BIN does this...

    # ANSWER.SRC/ANSWER.BIN
    # random logon screen for synchronet

    cls
    int x

    # seed x with a random number between the fixed range

    random x 3

    compare x 0
    if_equal
    pause_reset
    printfile "%zANSWER1.ANS"
    end_if

    compare x 1
    if_equal
    pause_reset
    printfile "%zANSWER2.ANS"
    end_if

    compare x 2
    if_equal
    pause_reset
    printfile "%zANSWER3.ANS"
    end_if

    There's definitely a problem with random numbers currently in v3.00 and it will be fixed before the release of v3.10.

    In the mean-time, I'd suggest you use the current time to generate a pseudo-random number. Example:

    # display answer0-3.ans
    int t
    str fname
    time t # get time (in seconds)
    and t 3 # just use lower 2 bits
    sprintf fname "%%zANSWER.%ld" t
    printfile fname # display file

    -Rob

    ---
    Synchronet Vertrauen Home of Synchronet [vert/cvs/bbs].synchro.net
  • From Hax0r@VERT/HAX0RQWK to Digital Man on Monday, July 16, 2001 16:16:00
    RE: umm...
    BY: Digital Man to Hax0r on Mon Jul 16 2001 07:03 pm

    There's definitely a problem with random numbers currently in v3.00 and it be fixed before the release of v3.10.

    heh.. glad that it just wasn't something i was doing -- has this been a known thing? i've used the random function before and it seemed to work ok...

    # display answer0-3.ans
    int t
    str fname
    time t # get time (in seconds)
    and t 3 # just use lower 2 bits
    sprintf fname "%%zANSWER.%ld" t
    printfile fname # display file

    thats a lot more elegant than my solution anyways... thanks for the tip!



    ---
    Synchronet .. hax0r's palace .. you've just been hax0r'd ..
  • From Digital Man@VERT to Hax0r on Tuesday, July 17, 2001 05:41:17
    RE: umm...
    BY: Hax0r to Digital Man on Mon Jul 16 2001 11:16 pm

    There's definitely a problem with random numbers currently in v3.00 and i be fixed before the release of v3.10.

    heh.. glad that it just wasn't something i was doing -- has this been a know thing?

    Nope, you're the first to discover/report it.

    i've used the random function before and it seemed to work ok...

    It works in the sense, that it produces pseudo-random numbers. The problem is that it produces the SAME numbers in the SAME order for every login. This has been fixed in v3.10 (each thread has to seed the random number generator).

    # display answer0-3.ans
    int t
    str fname
    time t # get time (in seconds)
    and t 3 # just use lower 2 bits
    sprintf fname "%%zANSWER.%ld" t
    printfile fname # display file

    thats a lot more elegant than my solution anyways... thanks for the tip!

    No problem. Thanks for the bug report.

    -Rob

    ---
    Synchronet Vertrauen Home of Synchronet [vert/cvs/bbs].synchro.net