Stupid Code Question

Discussion forum for G-Force users

Moderators: BTT, andy55, b.dwall, juxtiphi

User avatar
JayPro
Posts: 738
Joined: Sat May 01, 2004 10:51 pm
Location: Huntington Station, Long Island, New York

Stupid Code Question

Post by JayPro »

When you have a rnd() equation like:

A0= "1 +rnd(1)"

is that the same as if using the number with there being no rand factoring at all?

If so, then why not just use "1"?
"God is syntax."

User avatar
chkman
Posts: 329
Joined: Mon Aug 08, 2005 12:36 pm
Location: Greensburg, PA

Post by chkman »

No way the same! A0 could be anything from 1 to 2. Rnd(1) by itself should return anything between 0 and 1 which is added to the constant 1.

A0="2+rnd(2)", for example, could return anything from 2 to 4. Etc...

User avatar
JayPro
Posts: 738
Joined: Sat May 01, 2004 10:51 pm
Location: Huntington Station, Long Island, New York

Post by JayPro »

Thanks

So basically the rnd construct is kinda like multiplying:

I.E. 1+rnd(1) can be any integer from 1 to 2.

:. (therefore)

2 + rnd(5) can be anything from 2 to 10.

That said, I have a coupla further questions:

1. What does adding something like flor, sgn or sqrt do to the factorization (I know that sqr(rnd) increases randomness exponentially by whatever factor is reflected in the integers used) ?

2. How would changing the operator from + to * affect things? Would it be like using sqr(rnd) with plus?

Thanks.
"God is syntax."

User avatar
chkman
Posts: 329
Joined: Mon Aug 08, 2005 12:36 pm
Location: Greensburg, PA

Post by chkman »

No, 2 + rnd(5) would give a result between 2 and 7. Rnd(5) by itself would give 0-5.

1. Flor would return an integer somewhere in the range of the rnd, i.e. flor(rnd(5)) would return 0, 1, 2, 3, and 4. I'm not sure about 5 because rnd(5) might only goto 4.999999 or something. I could test it later....
Sgn just returns 0 or 1 I think, have to look it up. Sqrt would give the square root of whatever rnd returns. Sqr(rnd(5)) would square a number 0 to 5 resulting in 0 to 25. Could just use rnd(25) instead.

2. 2 * rnd(5) would return 0 thru 10. 2 + 2 * rnd(5) would return a number 2 thru 12, same as 2 + rnd(10).

Does that help?

User avatar
JayPro
Posts: 738
Joined: Sat May 01, 2004 10:51 pm
Location: Huntington Station, Long Island, New York

Post by JayPro »

Yes it did. Thanks.

I was gonna puke back a few examples of my own to make sure that I've got it understood. But a closer look at your examples make it clear.

So, then, you can use, I guess even exp(rnd) too, assuming you're daring enough to take randomization of your config to stellar heights.
"God is syntax."

User avatar
chkman
Posts: 329
Joined: Mon Aug 08, 2005 12:36 pm
Location: Greensburg, PA

Post by chkman »

For sgn (use sign, since sgn is deprecated) you would get a 1 for any number 0 or above. So using sign with rnd would be a waste unless you had the possibility of it going negative like sign(rnd(10) - 5). Result would be 0 if rnd(10) returned less than 5, 1 if 5 or greater.

Flor(rnd(1)) does, in fact, return a 1 cccasionally. My evidence is:
R="flor(rnd(1))*i"
G="flor(rnd(1))*i"
B="flor(rnd(1))*i"
Vers=300
Save as a colormap, if you wait awhile there will occasionally be some color meaning flor(rnd(1)) does sometimes return an integer of 1.

But if you want a colormap worth watching check this out:
CCal ="4 + rnd(4)"
R="rnd(1)*i"
G="rnd(1)*i"
B="rnd(1)*i"
Vers=300
Yessireedy, one of my best !!! :D

P.S. You're welcome (I had started the post when you posted).

User avatar
chkman
Posts: 329
Joined: Mon Aug 08, 2005 12:36 pm
Location: Greensburg, PA

Post by chkman »

JayPro,

Got some new configs? I'd be happy to post them on my website and include them in my crazy scripts....

User avatar
JayPro
Posts: 738
Joined: Sat May 01, 2004 10:51 pm
Location: Huntington Station, Long Island, New York

Post by JayPro »

Matter Of Fact:

I've been config-engineering like a madman recently, hence my not being so much a talking presence on this board lately as a busy behind-the scenes Mod/spambuster (Now if *that* were a paying job...LMAO).

Anyhow, sometime early this week, I'll shoot a file of my latest brainchildren to both you and Andy for him to include in the Extras archives at his leisure (Every time I'd swear up and down for the past month and a half that I'd do just that, a new "engineering" binge would take hold; hence this excuse).

Teaser: Some of the flowfields IMD(irt)HO just may be my best ones yet. And a few of the Particle/WaveShapes aren't altogether plain either..............
"God is syntax."

User avatar
chkman
Posts: 329
Joined: Mon Aug 08, 2005 12:36 pm
Location: Greensburg, PA

Post by chkman »

Cool, I look forward to it. I'll have 'em posted way before Andy gets around to it!!!!

Rovastar
Posts: 295
Joined: Wed May 05, 2004 9:25 am
Location: Derby/London, England

Post by Rovastar »

Always good to see new stuff from you JP.

User avatar
JayPro
Posts: 738
Joined: Sat May 01, 2004 10:51 pm
Location: Huntington Station, Long Island, New York

Post by JayPro »

I'm actually gonna spend some time today crossing my fingers and see if 3.5's gonna work for me.

Once that's done, I'll start bundling my new effects and sending them to all germaine parties.

In any even, the intended recipients should have everything *at the latest* by late tonite/early mañana.
"God is syntax."

User avatar
chkman
Posts: 329
Joined: Mon Aug 08, 2005 12:36 pm
Location: Greensburg, PA

Post by chkman »

Thanks, JayPro I got your email and wrote back to ya. Could you please resend that in ZIP format? I did find a PC program to unzip the sitz file but it will cost me $25 and I am broke right now.

Working on some colormaps.....

User avatar
JayPro
Posts: 738
Joined: Sat May 01, 2004 10:51 pm
Location: Huntington Station, Long Island, New York

Post by JayPro »

Did you check your mailbox? I resent it as per your request in a zip file about a half hour ago.
"God is syntax."

User avatar
chkman
Posts: 329
Joined: Mon Aug 08, 2005 12:36 pm
Location: Greensburg, PA

Post by chkman »

Thanks, I just love those spam filters, it let your 1st email thru and "protected" me from your 2nd one.

Very nice. Great new flowfields.

Some of your waves are actually particles. I'll have to sort thru them. Still hope to post 'em tonite....

User avatar
JayPro
Posts: 738
Joined: Sat May 01, 2004 10:51 pm
Location: Huntington Station, Long Island, New York

Post by JayPro »

You can, you know, simply change the status of the Particle by adding "Morphable = 4" to the Meta line.

I just figured that the ones I assigned the "1-3-3" rating would be abit intensive on the transition side.

EDIT: You've got mail explaining the aforementioned in greater detail.
"God is syntax."

Post Reply