Purple squiggles

    “And a bad PSC generator is good for something.”



    Crescent with a retort
    Crescent with a retort
    In the process of working on one task, an unexpected side effect arose. Visualizing a good pseudo-random number generator is noise and / or confusion. Obviously bad nobody wants to apply even for tests. I didn’t care, the very simple generator used completely satisfied me and, when handled carefully, produced an acceptable result. And suddenly, as if someone, with a confident stroke, began to give out elegant abstract drawings.
    Only 22 points are connected by Bezier curves and such a funny result. Zagogulins can be infinitely generated and are not bored to watch them, like clouds. You can come up with an interesting game - unravel what happened this time to us by chance, what is the pattern in it and come up with a name for it.
    But these curves have a more practical meaning. The generator is the product of the lower and upper parts of the processor tick counter, from which an unsigned remainder is taken. If you generate numbers rarely enough, randomness is tolerable. Here the numbers are generated often, randomness is bad, which is evident by the shapes of zagogulin. Despite the potential amount of 200 to the 22nd degree of different zagogulin, certain elements are most often repeated.
    Presumably, the degree of “shaggyness” of the figure depends on the load on the system in those microseconds when the numbers were generated. The diagonal line, aka “traveler,” speaks of an almost linear dependence of random numbers on time and a small load on the system. "Scalaria" - about greater chance, which means a fairly high load ...
    For those who want to have fun with purple squiggles, below is the code and some bright representatives.




    Some code
    ~ yz / lib / winctl.f
    REQUIRE WINDOWS ... ~ yz / lib / winlib.f
    0 VALUE win
    0 VALUE times
    0 VALUE hdc
    0 VALUE myrect
    0 VALUE mypen2
    22 VALUE dots
    0 VALUE fid
    CREATE 0d0a 0xD C, 0xA C, 
    CREATE * dots dots CELLS 3 * ALLOT
    : rnd TIMER @ * 200 UMOD;
    : rndxy dots 2 * 0 DO rnd 2 * 25 + I CELL * * dots +! rnd 3 * 25 + I CELL * * dots + CELL +! LOOP;
    : tre rndxy 
    S "X:" fid WRITE-FILE THROW 
    dots 2 * 0 DO I CELL * * dots + @ S> D (D.) fid WRITE-FILE THROW S "" fid WRITE-FILE THROW LOOP
    0d0a 2 fid WRITE-FILE THROW
    S "Y:" fid WRITE-FILE THROW
    dots 2 * 0 DO I CELL * * dots + CELL + @ S> D (D.) fid WRITE-FILE THROW S "" fid WRITE-FILE THROW LOOP
    0d0a 2 fid WRITE-FILE THROW
    0d0a 2 fid WRITE-FILE THROW
     ;
     rndxy
    WINAPI: CreatePen GDI32.dll
    WINAPI: PolyBezier GDI32.dll
    PROC: paint
      mypen2 windc SelectObject DROP
      dots * dots windc PolyBezier DROP
      rndxy
    PROC
    MESSAGES: my
    M: wm_lbuttondblclk
        rndxy 
        win winhide
        win winshow 
      TRUE
    M;
    MESSAGES;
    : run 
      WINDOWS ...
    S "warps.txt" R / W CREATE-FILE THROW TO fid
    0x00F00599 2 0 CreatePen TO mypen2
    0 create-window TO win
     win to winmain
     Bezieshki win -text!
    420 430 0 button place 
    this TO myrect
    10 10 myrect ctlresize
      ['] tre myrect -command!
    120 130 win winmove
    500 500 win winresize
       paint win -painter!
      my win -wndproc!
    win winshow
    ... WINDOWS
    fid CLOSE-FILE THROW
    BYE
    ;
    TRUE TO? GUI
    'run MAINX!
    S "warpy.exe" SAVE
    run
    


    This code, running in the SPF console, will create the executable file warpy.exe, which can already be run by itself. Double click (left button) on the picture changes it. The button in the lower right corner saves the X, Y coordinates to the warps.txt file


    More pictures
    Paraparabola

    Sparrow

    Scalaria

    Plectors

    Flower, top view

    Tulip

    Traveler

    Decanter with two bottles

    Lasso

    Kandinsky

    Also popular now: