Platform
Resources
Pricing
Sign in
Get started
Steve Wart
Workspace
Fork
Published
By
Steve Wart
Edited
Feb 4, 2022
ISC
Fork of
Artificial Body Shapes
Insert cell
Insert cell
Insert cell
function
d
(
n
)
{
return
Math
.
trunc
(
Math
.
random
(
)
*
n
+
1
)
}
Insert cell
Insert cell
Insert cell
Insert cell
Plot
.
rectY
(
samples
,
Plot
.
binX
(
{
y
:
'count'
}
,
{
x
:
'roll'
,
thresholds
:
100
,
fill
:
'steelblue'
}
)
)
.
plot
(
)
Insert cell
Insert cell
function
oe_low
(
)
{
let
result
=
d
(
100
)
,
next
=
0
if
(
result
>
5
)
return
result
do
{
next
=
d
(
100
)
result
-=
next
}
while
(
next
>
95
)
return
result
}
Insert cell
Insert cell
function
oe_high
(
)
{
let
result
=
d
(
100
)
,
next
=
0
if
(
result
<=
95
)
return
result
do
{
next
=
d
(
100
)
result
+=
next
}
while
(
next
>
95
)
return
result
}
Insert cell
Insert cell
function
oe100
(
)
{
let
result
=
d
(
100
)
,
next
=
0
if
(
result
>
95
)
{
do
{
next
=
d
(
100
)
result
+=
next
}
while
(
next
>
95
)
}
if
(
result
<
5
)
{
do
{
next
=
d
(
100
)
result
-=
next
}
while
(
next
>
95
)
}
return
result
}
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
Plot
.
rectY
(
oe_low_samples
,
Plot
.
binX
(
{
y
:
'count'
}
,
{
x
:
'roll'
,
thresholds
:
300
}
)
)
.
plot
(
)
Insert cell
Insert cell
Plot
.
rectY
(
oe_high_samples
,
Plot
.
binX
(
{
y
:
'count'
}
,
{
x
:
'roll'
,
thresholds
:
300
}
)
)
.
plot
(
)
Insert cell
Finally, for the Open-ended d100 case
Insert cell
Plot
.
rectY
(
oe_samples
,
Plot
.
binX
(
{
y
:
'count'
}
,
{
x
:
'roll'
,
thresholds
:
500
}
)
)
.
plot
(
)
Insert cell
Insert cell
two_roll_samples
=
{
let
samples
=
[
]
for
(
let
roll1
=
1
;
roll1
<=
100
;
roll1
++
)
{
for
(
let
roll2
=
1
;
roll2
<=
100
;
roll2
++
)
{
let
roll
=
(
roll1
<
5
)
?
roll1
-
roll2
:
(
(
roll1
>
95
)
?
roll1
+
roll2
:
roll1
)
samples
.
push
(
{
roll
}
)
}
}
return
samples
}
Insert cell
Insert cell
Plot
.
rectY
(
two_roll_samples
,
Plot
.
binX
(
{
y
:
'count'
}
,
{
x
:
'roll'
,
thresholds
:
300
}
)
)
.
plot
(
)
Insert cell
Insert cell
Insert cell
Plot
.
rectY
(
three_roll_samples
,
Plot
.
binX
(
{
y
:
'count'
}
,
{
x
:
'roll'
,
thresholds
:
200
}
)
)
.
plot
(
)
Insert cell
Purpose-built for displays of data
Observable is your go-to platform for exploring data and creating expressive data visualizations. Use reactive JavaScript notebooks for prototyping and a collaborative canvas for visual data exploration and dashboard creation.
Try it for free
Learn more
Compare fork
Fork
View
Export
Edit
Add comment
Select
Duplicate
Copy link
Embed
Delete
JavaScript
Markdown
HTML
Edit
Add comment
Select
Duplicate
Copy link
Embed
Delete
JavaScript
Markdown
HTML
d
Add comment
Copy import
Select
Duplicate
Copy link
Embed
Delete
JavaScript
Markdown
HTML
Edit
Add comment
Select
Duplicate
Copy link
Embed
Delete
JavaScript
Markdown
HTML
samples
Edit
Add comment
Copy import
Select
Duplicate
Copy link
Embed
Delete
JavaScript
Markdown
HTML
Edit
Add comment
Select
Duplicate
Copy link
Embed
Delete
JavaScript
Markdown
HTML
Add comment
Select
Duplicate
Copy link
Embed
Delete
JavaScript
Markdown
HTML
Edit
Add comment
Select
Duplicate
Copy link
Embed
Delete
JavaScript
Markdown
HTML
oe_low
Add comment
Copy import
Select
Duplicate
Copy link
Embed
Delete
JavaScript
Markdown
HTML
Edit
Add comment
Select
Duplicate
Copy link
Embed
Delete
JavaScript
Markdown
HTML
oe_high
Add comment
Copy import
Select
Duplicate
Copy link
Embed
Delete
JavaScript
Markdown
HTML
Edit
Add comment
Select
Duplicate
Copy link
Embed
Delete
JavaScript
Markdown
HTML
oe100
Add comment
Copy import
Select
Duplicate
Copy link
Embed
Delete
JavaScript
Markdown
HTML
Edit
Add comment
Select
Duplicate
Copy link
Embed
Delete
JavaScript
Markdown
HTML
oe_low_samples
Edit
Add comment
Copy import
Select
Duplicate
Copy link
Embed
Delete
JavaScript
Markdown
HTML
oe_high_samples
Edit
Add comment
Copy import
Select
Duplicate
Copy link
Embed
Delete
JavaScript
Markdown
HTML
oe_samples
Edit
Add comment
Copy import
Select
Duplicate
Copy link
Embed
Delete
JavaScript
Markdown
HTML
Edit
Add comment
Select
Duplicate
Copy link
Embed
Delete
JavaScript
Markdown
HTML
Add comment
Select
Duplicate
Copy link
Embed
Delete
JavaScript
Markdown
HTML
Edit
Add comment
Select
Duplicate
Copy link
Embed
Delete
JavaScript
Markdown
HTML
Add comment
Select
Duplicate
Copy link
Embed
Delete
JavaScript
Markdown
HTML
Add comment
Select
Duplicate
Copy link
Embed
Delete
JavaScript
Markdown
HTML
Add comment
Select
Duplicate
Copy link
Embed
Delete
JavaScript
Markdown
HTML
Edit
Add comment
Select
Duplicate
Copy link
Embed
Delete
JavaScript
Markdown
HTML
two_roll_samples
Add comment
Copy import
Select
Duplicate
Copy link
Embed
Delete
JavaScript
Markdown
HTML
Edit
Add comment
Select
Duplicate
Copy link
Embed
Delete
JavaScript
Markdown
HTML
Add comment
Select
Duplicate
Copy link
Embed
Delete
JavaScript
Markdown
HTML
Edit
Add comment
Select
Duplicate
Copy link
Embed
Delete
JavaScript
Markdown
HTML
three_roll_samples
Edit
Add comment
Copy import
Select
Duplicate
Copy link
Embed
Delete
JavaScript
Markdown
HTML
Add comment
Select
Duplicate
Copy link
Embed
Delete
JavaScript
Markdown
HTML