Weird pattern with dice function call results when injecting function call results as function parameters
- Dominant language
- C#
- Stars
- 4.9k
- Forks
- 540
- PR merge metrics
- No merged PRs in 30d
Description
Example
```
-> testing_fight_resolve_initiative
=== function rollD10()
{ shuffle:
- ~return 1
- ~return 2
- ~return 3
- ~return 4
- ~return 5
- ~return 6
- ~return 7
- ~return 8
- ~return 9
- ~return 10
}
=== function breakTie(result, result2)
comparing {result} vs {result2}
{
- result > result2:
~return 1
- result < result2:
~return 0
- else:
{ shuffle:
- ~return 0
- ~return 1
}
}
=== testing_fight_resolve_initiative
~temp roll = rollD10()
~temp roll2 = rollD10()
using temporary var roll: {roll} {roll2}
// resulter uses embedded two rollD10() calls within main primary function
~temp resulter = breakTie(rollD10(),rollD10())
{resulter}
```
The output:
```
using temporary var roll: 4 1
comparing 8 vs 9
0
```
When using
`~temp resulter = breakTie(rollD10(),rollD10())`,
the 2 rollD10() values always follow this pattern:
Examples"
`comparing 3 vs 4`
`comparing 6 vs 7`
`comparing 8 vs 9`
`comparing 5 vs 6`
`comparing 0 vs 1`
first number is always 1 less than the second number. Why??
When i seperate out the 2 rollD10s into 2 seperate temporary variables, it works okay, but when i bundle two rollD10s() together as function parameters inline, the result isn't random anymore, or at least the 2nd call result influences the 1st call result to always be Y-1.
Contributor guide
No contributing guide indexed for this repository
Assessment
This issue has not been assessed yet.