Talk:Pseudo-random numbers/PCG32: Difference between revisions
Content added Content deleted
m (→Help needed) |
Walterpachl (talk | contribs) m (→Help needed) |
||
Line 92: | Line 92: | ||
:: In some languages a long is 32 bits and a long long is 64 bits, so in those making it a long masks it to 32 bits. --[[User:Wherrera|Wherrera]] ([[User talk:Wherrera|talk]]) 17:24, 27 February 2021 (UTC) |
:: In some languages a long is 32 bits and a long long is 64 bits, so in those making it a long masks it to 32 bits. --[[User:Wherrera|Wherrera]] ([[User talk:Wherrera|talk]]) 17:24, 27 February 2021 (UTC) |
||
:::I am only talking and trying to understand Java. long is 64 bits. |
|||
Can anyone explain on bit level how this result comes about? |
|||
<pre> |
|||
public class how { |
|||
public static void main(String[] args) { |
|||
long old=0xCEC0317BC206D20CL; |
|||
System.out.printf("%nold=%d",old); |
|||
int shifted = (int) (((old >>> 18) ^ old) >>> 27); |
|||
System.out.printf("%nshifted=%d",shifted); |
|||
} |
|||
} |
|||
old=-3548782098761985524 |
|||
shifted=-671065735 ?????????????? |
|||
</pre> |
|||
doing the shif1t 18, the and, and the shift 27 gives me 402944 -:( |
|||
--Walter Pachl 20:37, 27 February 2021 (UTC) |