DEV Community

Cover image for What ๐Ÿ” burger ๐Ÿ” are you? Enter your name to find out! [Turning a string into Repeatable โ€œRandomโ€ Numbers / Seeds]
GrahamTheDev
GrahamTheDev

Posted on

What ๐Ÿ” burger ๐Ÿ” are you? Enter your name to find out! [Turning a string into Repeatable โ€œRandomโ€ Numbers / Seeds]

I found myself needing to create a basic system that takes a word or phrase as a seed and returns some "random numbers" that were repeatable if the same seed were entered.

Obviously they aren't actually random but I needed something that would spit out completely different numbers for "aaaa" compared to "aaab" for example.

Think of it like a very dumbed down version of how Minecraft generates worlds based on the seed you enter.

To test it out I decided to build a "design your own burger" system based on your name or a phrase!

As far as I can tell it works and it can actually be quite good fun trying different names and seeing if the resulting burger matches that persons personality!

Instructions

Super simple!

Step 1

Enter your name or a phrase in the first input (minimum 4 characters).

Your unique burger combination will show below once you have entered enough characters! Keep trying words, phrases, your name etc. until you find a beautiful burger. (it is case sensitive so try capitalised and not capitalised).

Step 2

Once you have found a burger combination you like (or hate and think would be funny) press the "Copy Markdown to clipboard" button below the ingredients list (or select and copy all the text in the <textarea> below the button).

Step 3

Paste the Markdown into a comment under the article.

Be sure to change the rating (if your burger creation isn't a 10 that is ๐Ÿ˜‰) and if you want you can give your burger a silly description!

Oh and if you find a truly disgusting burger combination be sure to share that also!

Try it out!

Don't forget to share your creations / your username burger in the comments!

My favourites

Here are 3 burgers I created:


The InHuOfficial Burger

InHu Logo

I couldn't possibly not share our very own burger namesake!

Apart from the blue cheese (not a fan) it seems like a beauty, double turkey bacon and bacon plus halloumi...delicious!

Username or phrase: InHuOfficial

Item Ingredients
Bun sesame seed
Patties elk burger patty, beef burger patty
Sauces chow chow, hot sauce, guacamole
Toppings turkey bacon, bacon, turkey bacon
Cheeses grilled halloumi, American cheese, blue cheese (stilton)
Salads coleslaw

My rating out of 10: 9
My super serious description ๐Ÿ˜‰: Eating this burger will improve your accessibility skills 200%!


The Independence Day burger

Had to fiddle a little bit to get a burger fit for America!

Three patties, American Cheese and a double helping of sweet potato fries seems like a good fit!

Username or phrase: 04th July

Item Ingredients
Bun crusty
Patties chicken breast burger patty, beef burger patty, bean burger patty
Sauces ranch dressing, chimichurri, sweet chilli
Toppings sweet potato fries, serrano ham, sweet potato fries
Cheeses american cheese
Salads lettuce, gherkin / pickles

My rating out of 10: 8
My super serious description ๐Ÿ˜‰: Nearly all American, if anything it perfectly reflects America in 2021 - American at the core with a nice sprinkling of flavours from other Countries and cultures to keep it interesting. A must try this July 4th!


The Ben Burger

Ben Halpern profile pix
How could we not include dev.to founder Ben?

The hilarious thing is it is an Elk burger (that is a Canadian thing right? Sorry I am an ignorant Brit)...and it has Maple Syrup on it....I couldn't stop laughing at the sterotype ๐Ÿ˜‹๐Ÿคฃ๐Ÿคฃ!

In all seriousness though I think this sounds like it could be delicious! Joe Rogan would obviously approve given his obsession with Elk!

Username or phrase: Ben Halpern

Item Ingredients
Bun sesame seed
Patties elk burger patty
Sauces maple syrup, bbq
Toppings serrano ham, onion rings, pulled pork
Cheeses american cheese, goats cheese
Salads coleslaw, roasted red peppers

My rating out of 10: 10
My super serious description ๐Ÿ˜‰: This burger proves Ben is Canadian. I don't think I could have made it better if I tried! ๐Ÿคฃ๐Ÿคฃ

A few little bits

No tutorial for this one, just some interesting bits of info.

There are over 29 BILLION different burgers that this generator can create.

If you ate one variation a day it would take you 79.6 million years to try them all.

It is probably flawed due to the way I built it so maybe there will be duplicates. It is just a silly project after all and my brain hurts already. If someone sees a flaw please point it out.

If you want to dig into my shoddy code here is a link to the fiddle: https://jsfiddle.net/aoc2L06p/

The key is

var seededRandom = function(seed, max, min) {
    max = max || 1000000000;
    min = min || 137;

    seed = (seed * 9301 + 49297) % 233280;
    var rnd = seed / 233280;

    return Math.round(min + rnd * (max - min), 0);
}
Enter fullscreen mode Exit fullscreen mode

Apparently the numbers used on lines 5 and 6 are carefully calculated to produce a very even appearance of random numbers.

Unfortunately I couldn't track down the article that explained it.

Conclusion

From my testing it appears to work fine. The actual seededRandom function does what I need it to do and that was where this all started.

So what is YOUR Burger? Does your name create a better burger than "Ben Halpern", "InHuOfficial" or "04th July"? Give it a try!

Click to Tweet:

Top comments (24)

Collapse
 
meekaphro profile image
Quentin

My Burger

Username or phrase: Quentin

Item Ingredients
Bun brown bread
Patties elk burger patty
Sauces Sriracha Butter
Toppings None
Salads jalapenos, jalapenos, grilled mushrooms

My rating out of 10: 8.75
My super serious description ๐Ÿ˜‰: cats and dogs wonโ€™t be able to resist you after eating this burger

Collapse
 
grahamthedev profile image
GrahamTheDev

I imagine that is going to burn both on the way in as well as on the way out! Sriracha and double jalapenos!

Collapse
 
meekaphro profile image
Quentin

Indeed, good thing I like spicy

Collapse
 
mafee6 profile image
Mafee7

So I put my name as monkey and:
Your burger ingredients
Bun: ciabatta
Patties: chicken breast burger patty, elk burger patty, turkey burger patty
Sauces: Gochujang
Toppings: ready salted crisps (potato chips)
Cheeses: monterey jack
Salads: avocado, kimchi, lettuce, kimchi

Collapse
 
grahamthedev profile image
GrahamTheDev

Double kimchi!

Also liking the idea of crisps, Monterey jack and Gochujang!

Monkey burger might just be on the menu!

Collapse
 
a03z profile image
Daniil

My Burger

Username or phrase: Daniil

Item Ingredients
Bun brown bread
Patties elk burger patty, turkey burger patty, beef burger patty
Sauces green pesto
Toppings bacon
Cheeses brie, gouda
Salads grilled aubergine (eggplant), sun dried tomatoes, jalapenos

My rating out of 10: 10
My super serious description ๐Ÿ˜‰:

Collapse
 
grahamthedev profile image
GrahamTheDev

I think that would be the perfect burger if it didn't have grilled aubergine!

Collapse
 
a03z profile image
Daniil

i think I will consider it a bug and fix :-)

Collapse
 
dariadia profile image
Danni • Edited

Wow. Like, WOW because Iโ€™m vegetarian, and the first burger that was created from my name actually has no meat. Itโ€™s magic ๐ŸŒŸ
The double ketchup is funny.

What do we want?
Ketchup!
Andโ€ฆ?
More ketchup!

My Burger

Username or phrase: Danni

Item Ingredients
Bun ciabatta
Patties bean burger patty
Sauces ketchup, ketchup
Toppings fried egg
Cheeses mozzarella
Salads None

My rating out of 10: 10

Collapse
 
grahamthedev profile image
GrahamTheDev

I am speechless as I haven't found a truly vegetarian one yet! Double of any sauce is always welcome! ๐Ÿ‘

Between that and Bens Canadian burger I do wonder if there is some witchcraft going on! ๐Ÿคฃ๐Ÿคฃ

Collapse
 
dariadia profile image
Danni

Witch approved! (Since I'm wiccan. Guess, I can approve stuff. Bless it I can) ๐Ÿ™Œ๐Ÿฝ

I was actually so fascinated by your burger creator that I wrote a similar one. It picks books for you. I work at an online library, and, currently, my collegues amuse themselves with the book-picker. One of them wrote "Who am I?" instead of a name, and got a book titled "Bitch" ๐Ÿ‘€. Another got a book on how to teach your kids during lockdown. He has three ๐Ÿ‘ถ๐Ÿฝ

Thread Thread
 
grahamthedev profile image
GrahamTheDev

Cool book chooser, I got Kate Charles - False Tongues, looks interesting!

I am glad you took something silly and made it useful! ๐Ÿ˜‹๐Ÿคฃ

Collapse
 
usenmfon_uko profile image
Usenmfon

My Burger

Username or phrase: Usenmfon

Item Ingredients
Bun English muffin
Patties bean burger patty
Sauces hot sauce
Toppings bacon
Cheeses brie, gouda, grilled halloumi
Salads gherkin / pickles

My rating out of 10: 10
My super serious description ๐Ÿ˜‰:

Collapse
 
grahamthedev profile image
GrahamTheDev

Well as I am British I have to approve any burger that uses an English Muffin! ๐Ÿคฃ

That burger looks like it would make an awesome breakfast burger!

Collapse
 
mohdahmad1 profile image
Mohd Ahmad

My Burger

Username or phrase: mohd_ahmad

Item Ingredients
Bun brioche
Patties portobello mushroom burger patty
Sauces red pesto, sour cream and chives, teriyaki sauce, chimichurri
Toppings fried egg
Cheeses mexicana cheese, monterey jack, parmesan
Salads gherkin / pickles, raw red onion, spring onions (scallions)

My rating out of 10: 10
My super serious description ๐Ÿ˜‰:

Collapse
 
grahamthedev profile image
GrahamTheDev

You managed to find a rare vegetarian one! I wonder if anyone can find a vegan one?

The sauces are the only thing that don't quite work on this, pesto, sour cream and teriyaki? I mean, never say never but I can't see that working ๐Ÿ˜‹๐Ÿคฃ

Collapse
 
siddharthshyniben profile image
Siddharth

My Burger

Username or phrase: siddharth

Item Ingredients
Bun crusty
Patties turkey burger patty, beef burger patty
Sauces green pesto
Toppings hash brown, chilli con carne
Cheeses mexicana cheese
Salads raw red onion, tomatoes

My rating out of 10: 7
My super serious description ๐Ÿ˜‰: Looks like something my brother would absolutely love!

Collapse
 
grahamthedev profile image
GrahamTheDev

I would defo be up for trying that, not sure about pesto and chilli con carne but I will try anything once ๐Ÿ˜‚

Collapse
 
afif profile image
Temani Afif

The Empty Burger

Username or phrase: โ€Žโ€‹โ€Žโ€‹

Item Ingredients
Bun ciabatta
Patties portobello mushroom burger patty, wagyu beef burger patty
Sauces ranch dressing
Toppings turkey bacon, hash brown, turkey bacon, bacon
Cheeses parmesan
Salads None
Collapse
 
grahamthedev profile image
GrahamTheDev • Edited

Certainly wouldnโ€™t leave you feeling empty! Quite surprised it wasnโ€™t a burger based on CSS!

I rate it a 10 though as wagyu beef and portobello mushrooms...delicious!

Collapse
 
afif profile image
Temani Afif

I don't care about your "minimum 4 characters"!

My Burger

Username or phrase: cssโ€Žโ€‹

Item Ingredients
Bun crusty
Patties chicken breast burger patty
Sauces green pesto, green pesto
Toppings bacon
Cheeses monterey jack
Salads fried onions, spring onions (scallions), grilled aubergine (eggplant), lettuce, spring onions (scallions), coleslaw

My rating out of 10: 5
My super serious description ๐Ÿ˜‰: I hate bacon

Collapse
 
grahamthedev profile image
GrahamTheDev • Edited

Look at you with โ€œhealthyโ€ burger...a rare 6 salad burger! ๐Ÿ˜œ๐Ÿคฃ

But โ€œhate baconโ€...how is that possible?

Collapse
 
grahamthedev profile image
GrahamTheDev • Edited

@ben I hope the burger my contraption designed is to your liking...I apologise that my code enforces stereotypes ๐Ÿ˜‹๐Ÿคฃ

I look forward to seeing some delicious (and not so delicious) burgers from you all!

Bonus points if your burger description or name is super silly ๐Ÿ˜