hedgewars/uRandom.pas
changeset 136 89970b70b076
parent 130 19e3c16fb9f0
child 155 401f4ea24715
equal deleted inserted replaced
135:53faa20669de 136:89970b70b076
     1 (*
     1 (*
     2  * Hedgewars, a worms-like game
     2  * Hedgewars, a worms-like game
     3  * Copyright (c) 2004, 2005 Andrey Korotaev <unC0Rr@gmail.com>
     3  * Copyright (c) 2004-2006 Andrey Korotaev <unC0Rr@gmail.com>
     4  *
     4  *
     5  * Distributed under the terms of the BSD-modified licence:
     5  * Distributed under the terms of the BSD-modified licence:
     6  *
     6  *
     7  * Permission is hereby granted, free of charge, to any person obtaining a copy
     7  * Permission is hereby granted, free of charge, to any person obtaining a copy
     8  * of this software and associated documentation files (the "Software"), to deal
     8  * of this software and associated documentation files (the "Software"), to deal
    48 n:= (n + 1) and $3F;
    48 n:= (n + 1) and $3F;
    49 cirbuf[n]:=
    49 cirbuf[n]:=
    50            (cirbuf[(n + 40) and $3F] +           {n - 24 mod 64}
    50            (cirbuf[(n + 40) and $3F] +           {n - 24 mod 64}
    51             cirbuf[(n +  9) and $3F])            {n - 55 mod 64}
    51             cirbuf[(n +  9) and $3F])            {n - 55 mod 64}
    52             and $7FFFFFFF;                       {mod 2^31}
    52             and $7FFFFFFF;                       {mod 2^31}
       
    53 
    53 Result:= cirbuf[n]
    54 Result:= cirbuf[n]
    54 end;
    55 end;
    55 
    56 
    56 procedure SetRandomSeed(Seed: shortstring);
    57 procedure SetRandomSeed(Seed: shortstring);
    57 var i: Longword;
    58 var i: Longword;