mirror of
https://github.com/vale981/phys512
synced 2025-03-04 09:11:37 -05:00
Remove type info from lcg generator; fix typo in README
This commit is contained in:
parent
845965a2b9
commit
dfa7a3eba1
2 changed files with 6 additions and 7 deletions
|
@ -9,6 +9,6 @@ Built with [Jupyter Book](https://jupyterbook.org/intro.html)
|
|||
|
||||
To update the website use
|
||||
|
||||
`jupyter-book build ../phys645`
|
||||
`jupyter-book build ../phys512`
|
||||
|
||||
`ghp-import -n -p -f _build/html`
|
||||
|
|
11
lcg.ipynb
11
lcg.ipynb
|
@ -27,7 +27,7 @@
|
|||
},
|
||||
{
|
||||
"cell_type": "code",
|
||||
"execution_count": 3,
|
||||
"execution_count": 1,
|
||||
"id": "3598ae23",
|
||||
"metadata": {},
|
||||
"outputs": [],
|
||||
|
@ -38,17 +38,16 @@
|
|||
},
|
||||
{
|
||||
"cell_type": "code",
|
||||
"execution_count": 4,
|
||||
"execution_count": 2,
|
||||
"id": "73fab248",
|
||||
"metadata": {},
|
||||
"outputs": [],
|
||||
"source": [
|
||||
"# This is the implementation of an LCG from Wikipedia\n",
|
||||
"# https://en.wikipedia.org/wiki/Linear_congruential_generator\n",
|
||||
"# (simplified by removing type info)\n",
|
||||
"\n",
|
||||
"from collections.abc import Generator\n",
|
||||
"\n",
|
||||
"def lcg(modulus: int, a: int, c: int, seed: int) -> Generator[int, None, None]:\n",
|
||||
"def lcg(modulus, a, c, seed):\n",
|
||||
" \"\"\"Linear congruential generator.\"\"\"\n",
|
||||
" while True:\n",
|
||||
" seed = (a * seed + c) % modulus\n",
|
||||
|
@ -57,7 +56,7 @@
|
|||
},
|
||||
{
|
||||
"cell_type": "code",
|
||||
"execution_count": 39,
|
||||
"execution_count": 3,
|
||||
"id": "d2b53d68",
|
||||
"metadata": {
|
||||
"scrolled": false
|
||||
|
|
Loading…
Add table
Reference in a new issue