Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
So I...
#31
:rotfl: - rotflmao
Reply
#32
I remember that XOR stuff, Relsoft. We had a thread about it:
http://forum.qbasicnews.com/viewtopic.php?t=3836

The issue was to get a good random generator. Antoni has posted a real good one, that generates a 0-255 random number in good conditions.

In the algorithms of my Perlin tuto, based on Ken Perlin's logics, the standard RND is fine. With my own algorithm, I had to use a RND(-RND) trick...

You will probably get good results now you got the XOR meaning Big Grin

You may have heard about a guy named Mathieu Ricard. If not, Google a little around him. He works with the Dalai Lama. I've been really happy to be reading his last book today, for personal reasons: he would probably tell you to finalise your program :wink:
hink Global, Make Symp' All ! ®
[Image: Banner.gif]
Reply
#33
Here is the random function. I think i found it in some link of Hugo Elias' page...
Code:
FUNCTION randomnum STATIC
   'randomnum returns a random integer in the range 0-255
   'the seed  should be a global variable
   CONST seed = 34
   'mask is the mask limiting the size of the output
   CONST mask = &HFF
   IF m = 0 THEN a = seed AND mask: m = 32000
   m = m - 1
   q1 = q1 + 1
   IF q1 >= v1 THEN
    q1 = 0
    p = p + a AND mask
    v1 = -v1
   END IF
   q2 = q2 + 1
   IF q2 >= v2 THEN
    q2 = 0
    p = p + a AND mask
    v2 = -v2
   END IF
   q3 = q3 + 1
   IF q3 >= v3 THEN
    q3 = 0
    p = p + a AND mask
    v3 = -v3
   END IF
   q4 = q4 + 1 AND mask
   IF q4 = p THEN
    a = a + 1 AND 15
   END IF
   v1 = p
   p = p + v1 + v2 + v3 AND mask
   v3 = v2
   v2 = v1
   randomnum = v1
END FUNCTION
I don't know if it can be useful, I benchmarked it and it's slower than QB's RND + ffix..


Go for it, Rel!
Antoni
Reply
#34
I'll try. Thanks(Jark/Antoni). But I'm having some health issues right now. That me being in front of this computer is even "illegal".

:*(

Maybe when I get better. :*)
y smiley is 24 bit.
[Image: anya2.jpg]

Genso's Junkyard:
http://rel.betterwebber.com/
Reply
#35
Howz your uric acid level? Sad
Reply
#36
PM anyone?
SCUMM (the band) on Myspace!
ComputerEmuzone Games Studio
underBASIC, homegrown musicians
[img]http://www.ojodepez-fanzine.net/almacen/yoghourtslover.png[/i
Reply
#37
I think we should ALL PM...
hink Global, Make Symp' All ! ®
[Image: Banner.gif]
Reply
#38
Yeah :oops:
Reply
#39
Quote:Howz your uric acid level? Sad

I will certainly find out about its levels come Feb. 28th. :*)

Rel=Shortness of breath guy. :*(

What's funny is that:

1. I'm not obese
2. ECG Normal
3. X-ray normal

But I still get heart palpitations.

I'm taking metoprolol to make my heart beat slower. :*(
And this is prolly for life. :*(
y smiley is 24 bit.
[Image: anya2.jpg]

Genso's Junkyard:
http://rel.betterwebber.com/
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)