Skip to content

Instantly share code, notes, and snippets.

View DavidMellul's full-sized avatar

David Mellul DavidMellul

View GitHub Profile
<?php
/* Database configuration and so on...*/
$todo_list = $database->retrieve_all_todos();
<ul>
foreach($todo_list as $todo) {
echo "<li> Task number $todo['id'] -> $todo['description'] </li>";
}
</ul>
# Seed = 10
Kernel.srand 10
def generate_random_uid
# Generate a random value between 0 and 1 000 000
base_pseudo_random_value = rand(1_000_000)
uid = evil_maths(base_pseudo_random_value)
return uid
end
if first_launch?
uid = generate_random_uid()
# First 3 pseudo random numbers
10
12
14
# Second 3 pseudo random numbers
18
20
22
class PseudoRandomness
# This is the constructor used to instantiate a PseudoRandomness object
def initialize(seed)
@instance_seed = seed
end
def change_seed
@instance_seed = @instance_seed + 1
end
class PseudoRandomness
# This is the constructor used to instantiate a PseudoRandomness object
def initialize(seed)
@instance_seed = seed
end
def change_seed
@instance_seed = @instance_seed + 1