You filed it *where*?



  • Looking through some legacy Macintosh APIs, I found this:

    Random
    Obtains a pseudorandom integer.
    

    short Random ();
    Return Value
    A pseudorandom integer, uniformly distributed in the range -32767 to 32767.

    No WTF there: it's a fairly typical random-number generator, with a range typical of the 16-bit era when it was developed.

    Declared In
    Quickdraw.h
    But it's part of the graphics API. Why?


  • @Carnildo said:

    Looking through some legacy Macintosh APIs

    ... why?

    That said, I love those Mac Classic APIs. Talk about a clean, clear, easy-to-use API that makes it actually difficult to *mis*use the OS's features. Sigh. .NET is close, but... Mac Classic still rules.



  • @Carnildo said:

    But it's part of the graphics API. Why?
    You can use random numbers in algorithms that estimate areas/volumes of objects. So I am not surprised it is there. You should go and read a book on fundamental graphics operations if you are going to poke around in places like this.


  • Winner of the 2016 Presidential Election

    @OzPeter said:

    You can use random numbers in algorithms that estimate areas/volumes of objects.

    Even with this statement being true, there are applications of random numbers outside of graphics, so it would make an equal or greater amount of sense to include it in a crypto header file, or a math header file (where it belongs, IMHO), or an audio header file, etc.

    Having everything that needs a random number link off to the graphics library creates a pretty screwy dependency graph.



  • @joe.edwards said:

    @OzPeter said:
    You can use random numbers in algorithms that estimate areas/volumes of objects.

    Even with this statement being true, there are applications of random numbers outside of graphics, so it would make an equal or greater amount of sense to include it in a crypto header file, or a math header file (where it belongs, IMHO), or an audio header file, etc.

    Having everything that needs a random number link off to the graphics library creates a pretty screwy dependency graph.

     

    But having everything with a dependency graph link off to the graphics library is just common sense, no?

    If you're writing everything from the ground up, where do you put the square root calculation?  Statistics, because you use it to compute standard deviations?  Or geo-mapping because you need the Pythagorean theorem to do distances?  Place I worked it was the latter, for the single and simple reason that the geo stuff was needed first.



  • @da Doctah said:

    If you're writing everything from the ground up, where do you put the square root calculation?  Statistics, because you use it to compute standard deviations?  Or geo-mapping because you need the Pythagorean theorem to do distances?  Place I worked it was the latter, for the single and simple reason that the geo stuff was needed first.

    You wrote your library from scratch?

    BTW, it's virtually impossible to create a Classic Mac program without a dependency on QuickDraw anyway. Since the OS had no CLI, even if all your program did was make a fake terminal, it still needed QuickDraw to draw the windows and scrollbars and fonts and such. So... in the real world, this goofy placement didn't really hurt anything.



  • @blakeyrat said:

    @da Doctah said:
    If you're writing everything from the ground up, where do you put the square root calculation?  Statistics, because you use it to compute standard deviations?  Or geo-mapping because you need the Pythagorean theorem to do distances?  Place I worked it was the latter, for the single and simple reason that the geo stuff was needed first.

    You wrote your library from scratch?

     

    TPF mainframe stuff.  In what is essentially S/370 assembler.  And every module is limited to 1055 bytes.  And where the only documentation you can find on floating point is "there are floating point opcodes and you don't need to know about them".



  • FWIW, I asked internally and was told that it was needed to implement dithering, and SANE (the Standard Apple Numerics package - a logical place to put it) didn't exist yet. It came over from the Lisa's QuickDraw. I assume it was also used for dithering over there, but am not positive. So yeah, kind of an odd place, but it would appear they didn't need it elsewhere before that.



  • @dcardani said:

    FWIW, I asked internally and was told that it was needed to implement dithering, and SANE (the Standard Apple Numerics package - a logical place to put it) didn't exist yet. It came over from the Lisa's QuickDraw. I assume it was also used for dithering over there, but am not positive. So yeah, kind of an odd place, but it would appear they didn't need it elsewhere before that.

    So wait, you work at Apple? Is Apple planning on reviving Classic or something?



  • @blakeyrat said:

    @dcardani said:
    FWIW, I asked internally and was told that it was needed to implement dithering, and SANE (the Standard Apple Numerics package - a logical place to put it) didn't exist yet. It came over from the Lisa's QuickDraw. I assume it was also used for dithering over there, but am not positive. So yeah, kind of an odd place, but it would appear they didn't need it elsewhere before that.

    So wait, you work at Apple? Is Apple planning on reviving Classic or something?

    Yes, I do. I don't know of any plans to revive Classic. I just asked the people who are still there who worked on it.


  • Discourse touched me in a no-no place

    @dcardani said:

    I don't know of any plans to revive Classic.
    That's a damned shame. It would make a glorious baseline for OS11 - simple, low-profile, and forces you to run any modern application in The Cloud(TM)



  • @Weng said:

    @dcardani said:

    I don't know of any plans to revive Classic.
    That's a damned shame. It would make a glorious baseline for OS11 - simple, low-profile, and forces you to run any modern application in The Cloud(TM)

    Don't mock my Mac Classic. Them's fighting words!


  • Discourse touched me in a no-no place

     No dude. I'm being serious. Mac Classic was awesome. My failover "Fucking PC needs a reformat" computer was a System 7.6 M68k box up until I outgrew needing to reformat on a regular basis. But really, think about it. It's the PERFECT "modern" OS - lightweight, portable (seriously, I'm sure you could port that codebase to any hardware in a matter of WEEKS - the whole thing is outsized by a fucking modern printer driver), modular, and supports just enough to get internet access.



  • Apple should release the source. That would be EPIC.

    But they're too busy catering to douchebags in coffeeshops and shipping insecure OS configurations.



  • Classic Mac as an open source project?

    It'll be Linux all over again.



  • @Carnildo said:

    A pseudorandom integer, uniformly distributed in the range -32767 to 32767.
     

    Why the hell is it -32767 instead of -32768 though?


  • Discourse touched me in a no-no place

    @dtech said:

    @Carnildo said:

    A pseudorandom integer, uniformly distributed in the range -32767 to 32767.
     

    Why the hell is it -32767 instead of -32768 though?

    One's complement/sign-magnitude implementation? Ignorance?



  • @PJH said:

    @dtech said:

    @Carnildo said:

    A pseudorandom integer, uniformly distributed in the range -32767 to 32767.
     

    Why the hell is it -32767 instead of -32768 though?

    One's complement/sign-magnitude implementation? Ignorance?

    Typo in the documentation? Some weird mathematical quirk of their RNG implementation?

    The actual machine used Two's Complement.


Log in to reply
 

Looks like your connection to What the Daily WTF? was lost, please wait while we try to reconnect.