Merge pull request #201 from nature-of-code/notion-update-docs
|
@ -212,7 +212,7 @@
|
|||
// A random floating point between 0 and 1
|
||||
let r = random(1);
|
||||
// If the random number is less than 0.1, sing!
|
||||
if (r < prob) {
|
||||
if (r < probability) {
|
||||
print("Sing!");
|
||||
}</pre>
|
||||
<p>This method can also be applied to multiple outcomes. Let’s say that singing has a 60% chance of happening, dancing, a 10% chance, and sleeping, a 30% chance. This can be implemented by picking a random number and seeing into what range it falls.</p>
|
||||
|
@ -338,7 +338,7 @@
|
|||
</div>
|
||||
<pre class="codesplit" data-code-language="javascript"> void draw() {
|
||||
//{!1} Here, x is a draw from a normal distribution with mean 320 and standard deviation 60
|
||||
float x = randomGaussian(320, 60);
|
||||
let x = randomGaussian(320, 60);
|
||||
noStroke();
|
||||
fill(0,10);
|
||||
ellipse(x, 180, 16, 16);
|
||||
|
|
Before Width: | Height: | Size: 58 KiB After Width: | Height: | Size: 61 KiB |
Before Width: | Height: | Size: 76 KiB After Width: | Height: | Size: 69 KiB |
Before Width: | Height: | Size: 274 KiB After Width: | Height: | Size: 334 KiB |
Before Width: | Height: | Size: 87 KiB After Width: | Height: | Size: 84 KiB |
Before Width: | Height: | Size: 150 KiB After Width: | Height: | Size: 163 KiB |
Before Width: | Height: | Size: 123 KiB After Width: | Height: | Size: 125 KiB |