Skip to content

Commit

Permalink
Merge pull request #5 from AdrianScott/patch-4
Browse files Browse the repository at this point in the history
fixed case of _generateDNA to match code
  • Loading branch information
fubuloubu committed Oct 7, 2022
2 parents 8c7c167 + 0e2d614 commit 3e70920
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions 1/keccak256-and-typecasting.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
# Chapter 11: Keccak256 and Typecasting

We want our `_generateRandomDna` function to return a (semi) random `uint256`. How can we accomplish this?
We want our `_generateRandomDNA` function to return a (semi) random `uint256`. How can we accomplish this?

Ethereum has the [hash function](https://en.wikipedia.org/wiki/Hash_function) `keccak256` built in, which is a version of SHA3. A hash function basically maps an input into a random 256-bit hexadecimal number. A slight change in the input will cause a large change in the hash.

Expand Down Expand Up @@ -46,7 +46,7 @@ All type conversions in Vyper must be made explicitly using the built-in `conver

## Put it to the test

Let's fill in the body of our `_generateRandomDna` function! Here's what it should do:
Let's fill in the body of our `_generateRandomDNA` function! Here's what it should do:

1. Generate `keccak256` hash of the `_name` argument.
2. Convert this hash into a `uint256` and assign its value to a `uint256` variable named `random`.
Expand Down

0 comments on commit 3e70920

Please sign in to comment.