Commit 103d5aa
committed
Refactor jerry-libc's rand() and srand()
* Making sure that the type of the state variables is OK
(`uint32_t` instead of `unsigned int`).
* Making sure that globals are accessed as rarely as possible in
`rand`, and getting type conversions OK.
* Fixing `srand` to write all state variables and thus indeed
generate the same random sequence.
JerryScript-DCO-1.0-Signed-off-by: Akos Kiss akiss@inf.u-szeged.hu1 parent 13bee3c commit 103d5aa
1 file changed
+7
-5
lines changed| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
28 | 28 | | |
29 | 29 | | |
30 | 30 | | |
31 | | - | |
| 31 | + | |
32 | 32 | | |
33 | 33 | | |
34 | 34 | | |
| |||
240 | 240 | | |
241 | 241 | | |
242 | 242 | | |
243 | | - | |
| 243 | + | |
| 244 | + | |
244 | 245 | | |
245 | 246 | | |
246 | 247 | | |
| |||
250 | 251 | | |
251 | 252 | | |
252 | 253 | | |
253 | | - | |
254 | | - | |
255 | | - | |
| 254 | + | |
256 | 255 | | |
257 | 256 | | |
258 | 257 | | |
| |||
261 | 260 | | |
262 | 261 | | |
263 | 262 | | |
| 263 | + | |
| 264 | + | |
| 265 | + | |
264 | 266 | | |
265 | 267 | | |
0 commit comments