Pen Settings



CSS Base

Vendor Prefixing

Add External Stylesheets/Pens

Any URL's added here will be added as <link>s in order, and before the CSS in the editor. You can use the CSS from another Pen by using it's URL and the proper URL extention.

+ add another resource


Babel includes JSX processing.

Add External Scripts/Pens

Any URL's added here will be added as <script>s in order, and run before the JavaScript in the editor. You can use the URL of any other Pen and it will include the JavaScript from that Pen.

+ add another resource


Add Packages

Search for and use JavaScript packages from npm here. By selecting a package, an import statement will be added to the top of the JavaScript editor for this package.


Save Automatically?

If active, Pens will autosave every 30 seconds after being saved once.

Auto-Updating Preview

If enabled, the preview panel updates automatically as you code. If disabled, use the "Run" button to update.

Format on Save

If enabled, your code will be formatted when you actively save your Pen. Note: your code becomes un-folded during formatting.

Editor Settings

Code Indentation

Want to change your Syntax Highlighting theme, Fonts and more?

Visit your global Editor Settings.


                <h3>Dice Online Verifier</h3>	
<div id="container" class="container">
	<div id="form" class="block">
		<div class="field">
			<label for="server_seed">Server seed</label>
			<input id="server_seed" type="text" class="form_text"/>
		<div class="field">
			<label for="client_seed">Client seed</label>
			<input id="client_seed" type="text" class="form_text"/>
		<div class="field">
			<label for="nonce">Nonce</label>
			<input id="nonce" type="text" class="form_text"/>
		<div class="field">
			<label for="hash">Server seed SHA512</label>
			<textarea id="hash" type="text" class="form_text" disabled></textarea>
	<div class="block">
		<label for="resultPanel">Result</label>
		<div id="resultPanel" class="resultPanel"></div>


                body {
	font-family: "Roboto Mono", monospace !important;
	min-width: 320px;
	box-sizing: border-box;
	padding: 10px;
	h3 {
		margin-left: 2.5px;
	.container {
		display: flex;
		flex-wrap: wrap;
		width: 100%;
		box-sizing: border-box;
		.block {
			flex: 1;
			min-width: 250px;
			margin: 0 2.5px;
			box-sizing: border-box;
			label {
				font-weight: bold;
				font-size: 20px;
				box-sizing: border-box;
			.field {
				display: flex;
				flex-direction: column;
				box-sizing: border-box;
				margin-bottom: 5px;
				input {
					font-size: 13px;
					padding: 5px;
					width: 100%;
					border-radius: 5px;
					border: 1px solid #888888;
					box-sizing: border-box;
					background-color: #ffffe1;
				textarea {
					resize: none;
					height: 80px;
				.configDescription {
					display: inline-block;
					font-size: 15px;

.c {
	display: flex;
	align-items: center;
	justify-content: center;
	font-size: 30px;
	width: 100px;
	height: 48px;
	border-radius: 10px;
	border: 4px solid #333;
	background-color: lightgrey;


                const params = {

const roll = (serverSeed, clientSeed, nonce) => {
	const keyString = clientSeed + "-" + nonce;
	const hash = sha512.hmac(serverSeed, keyString);
	const random = parseInt(hash.substring(0, 5), 16) / 1048576;
	//from min - under max values
	const max = 10000;	
	return Math.floor(random * max);	

function showRandomResult(random){		
	$("#hash").val(sha512.hmac(params.server_seed, ''));
	let str = "" + random;
	while(str.length < 4) str="0" + str;
	str = `${str.substr(0,2)}.${str.substr(2)}`;
	$("#resultPanel").html(`<div class='c'><b>${str}</b></div>`);		

const calculateResult = () => {	
	for(let k in params) params[k] = $("#" + k).val().trim();
	let random = roll(params.server_seed, params.client_seed, params.nonce);

window.onload = function(){
		let url_string = (window.location.href);
		let url = new URL(url_string);		
		for(let k in params) {
			let value = url.searchParams.get(k);
				value = atob(value).trim();
				params[k] = value;
				$("#" + k).val(value);