Code: Select all
A_CustomPunch(2*random(1,10),1)
Code: Select all
A_CustomPunch(2*frandom(1,10),1)
For reference, taken from the source for A_Punch:
Code: Select all
static FRandom pr_punch ("Punch");
damage = (pr_punch()%10+1)<<1;
Code: Select all
A_CustomPunch(2*random(1,10),1)
Code: Select all
A_CustomPunch(2*frandom(1,10),1)
Code: Select all
static FRandom pr_punch ("Punch");
damage = (pr_punch()%10+1)<<1;
Well, yes, because frandom churns out floating point numbers. You'd get results like 4.5, 4.7, 5.3, 7.2, 7.9 instead of 4, 5, 7 or 8, for example.Will these even present different results in this scenario?
Ah. You're getting confused by coincidence here.Ed the Bat wrote:Makes sense to me. I was just a little put off by how the raw source used frandom(), followed by integer math, and it made me uneasy about how it might affect the probabilities.
For mimicking internal functions, yes, but don't hesitate to use frandom if it suits your needs.Ed the Bat wrote:So, if I want to directly mimic internal functions like this, should I stick exclusively to random, instead of frandom in my DECORATE?
It is not, DECORATE random2 calls FRandom::random2.Ed the Bat wrote:Also, I'm seeing random2() appear in the raw source. Is this another instance where the DECORATE function is completely unrelated? I'm getting in a bit over my head with this stuff.