I Changed your package to +1 in {x+1,a} as below
BeginPackage["qpackage`"]
Unprotect[rFunc];
rFunc::usage="does it keep same random number?"
Begin["`Private`"]
a=RandomReal[];
rFunc[x_] := {x+1,a}
End[]
EndPackage[]
api3 with load of package and api4 without loading the package
api3 = CloudDeploy[APIFunction[{"x" -> "Number"},
(Get["qpackage`"];
qpackage`rFunc[#x])
&],
CloudObject["api3"],
Permissions -> "Public"]
api4 = CloudDeploy[APIFunction[{"x" -> "Number"},
(qpackage`rFunc[#x])
&],
CloudObject["api4"],
Permissions -> "Public"]
api3 delivers 1 added to 4 and 8 unique numbers
Table[URLExecute[api3, {"x" -> 4}], {8}] // Tally
{{{5, 0.977889}, 1}, {{5, 0.672346}, 1}, {{5, 0.600011},
1}, {{5, 0.949759}, 1}, {{5, 0.811612}, 1}, {{5, 0.625906},
1}, {{5, 0.530472}, 1}, {{5, 0.658866}, 1}
}
api4 delivers 1 added to each i but no unique random numbers anymore. They repeat every 4 times. So the function is active and can be used if defined delayed?
Table[URLExecute[api4, {"x" -> i}], {i, 1, 8}]
{{2, 0.530472}, {3, 0.658866}, {4, 0.811612}, {5, 0.625906}, {6,
0.530472}, {7, 0.658866}, {8, 0.811612}, {9, 0.625906}}