82 umask = -2147483648_8, &
85 integer,
parameter ::
tmaskb= -1658038656, &
91 integer :: currentelement
92 integer,
dimension(0:blockSize -1) :: state
108 integer,
intent( in) :: u, v
115 integer,
intent( in) :: u, v
119 integer,
parameter,
dimension(0:1) :: t_matrix = (/ 0,
matrix_a /)
121 twist = ieor(ishft(
mixbits(u, v), -1), t_matrix(iand(v, 1)))
122 twist = ieor(ishft(
mixbits(u, v), -1), t_matrix(iand(v, 1)))
126 type(randomNumberSequence),
intent(inout) :: twister
132 twister%state(k) = ieor(twister%state(k +
m), &
133 twist(twister%state(k), twister%state(k + 1)))
136 twister%state(k) = ieor(twister%state(k +
m -
blocksize), &
137 twist(twister%state(k), twister%state(k + 1)))
139 twister%state(
blocksize - 1) = ieor(twister%state(
m - 1), &
141 twister%currentElement = 0
145 elemental function temper(y)
146 integer,
intent(in) :: y
152 x = ieor(y, ishft(y, -11))
153 x = ieor(x, iand(ishft(x, 7),
tmaskb))
154 x = ieor(x, iand(ishft(x, 15),
tmaskc))
155 temper = ieor(x, ishft(x, -18))
161 integer,
intent(in ) :: seed
169 twister%state(0) = iand(seed, -1)
171 twister%state(i) = 1812433253 * ieor(twister%state(i-1), &
172 ishft(twister%state(i-1), -30)) + i
173 twister%state(i) = iand(twister%state(i), -1)
179 integer,
dimension(0:),
intent(in) :: seed
182 integer :: i, j, k, nfirstloop, nwraps
190 j = mod(k - 1,
size(seed))
192 twister%state(i) = twister%state(
blocksize - 1)
193 twister%state(1) = ieor(twister%state(1), &
194 ieor(twister%state(1-1), &
195 ishft(twister%state(1-1), -30)) * 1664525) + &
197 twister%state(i) = iand(twister%state(i), -1)
200 twister%state(i) = ieor(twister%state(i), &
201 ieor(twister%state(i-1), &
202 ishft(twister%state(i-1), -30)) * 1664525) + &
204 twister%state(i) = iand(twister%state(i), -1)
212 twister%state(i) = ieor(twister%state(i), &
213 ieor(twister%state(i-1), &
214 ishft(twister%state(i-1), -30)) * 1566083941) - i
215 twister%state(i) = iand(twister%state(i), -1)
218 twister%state(0) = twister%state(
blocksize - 1)
220 do i = 1, mod(nfirstloop,
blocksize) + nwraps
221 twister%state(i) = ieor(twister%state(i), &
222 ieor(twister%state(i-1), &
223 ishft(twister%state(i-1), -30)) * 1566083941) - i
224 twister%state(i) = iand(twister%state(i), -1)
227 twister%state(0) =
umask 247 twister%currentElement = twister%currentElement + 1
276 if(localint < 0)
then 277 getrandomreal = dble(localint + 2.0d0**32)/(2.0d0**32 - 1.0d0)
integer function twist(u, v)
integer, parameter tmaskc
subroutine, public finalize_randomnumbersequence(twister)
integer, parameter blocksize
integer function, public getrandomint(twister)
integer, parameter matrix_a
type(randomnumbersequence) function initialize_vector(seed)
double precision function, public getrandomreal(twister)
integer function, public getrandompositiveint(twister)
type(randomnumbersequence) function initialize_scalar(seed)
integer function mixbits(u, v)
integer, parameter tmaskb
subroutine nextstate(twister)
elemental integer function temper(y)