Skip to content

Instantly share code, notes, and snippets.

View janoy1's full-sized avatar
🏠
Working from home

janoy1

🏠
Working from home
View GitHub Profile
@janoy1
janoy1 / Calc.java
Created June 4, 2020 03:53 — forked from DaveGu/Calc.java
Simple calculator in Java
import java.util.*
//Simple calculator
public class calc
{
public static void main(String[] args)
{
Scanner in = new Scanner(System.in);
double a, b, c = 0.0;
@janoy1
janoy1 / RouletteGame.java
Created March 31, 2020 03:12 — forked from hunterruth/RouletteGame.java
Roulette Game
import java.util.Random;
import java.util.Scanner;
public class RouletteGame
{
public static void main(String[] args)
{
Scanner keyboard = new Scanner(System.in);
Random generator = new Random();
@janoy1
janoy1 / Random generator
Created March 25, 2020 22:48 — forked from alexvandesande/Random generator
A very simple random generator. A miner can influence the number by not publishing a block with an unwanted outcome, and forfeiting the 5 block reward.
contract random {
/* Generates a random number from 0 to 100 based on the last block hash */
function randomGen(uint seed) constant returns (uint randomNumber) {
return(uint(sha3(block.blockhash(block.number-1), seed ))%100);
}
/* generates a number from 0 to 2^n based on the last n blocks */
function multiBlockRandomGen(uint seed, uint size) constant returns (uint randomNumber) {
uint n = 0;
for (uint i = 0; i < size; i++){