Skip to content

Commit

Permalink
Refreshed java random numbers (hoping for better ranking at google)
Browse files Browse the repository at this point in the history
  • Loading branch information
eiselems committed Jan 11, 2020
1 parent d5388e0 commit f0e85f3
Show file tree
Hide file tree
Showing 3 changed files with 91 additions and 4 deletions.
Binary file added .jekyll-metadata
Binary file not shown.
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ Let's first start with the basics.
Java provides at least fours ways of properly creating random numbers.

### 1. Using Math.random Method
The most basic way of generating Random Numbers in Java is to use the `Math.random()` method.
The most basic way of generating Random Numbers in Java is to use the [`Math.random()`](https://docs.oracle.com/javase/8/docs/api/java/lang/Math.html#random--) method.

It doesn't take any parameter and simply returns a number which is greater than or equal 0.0 and less than 1.0. In comparison to other methods, `Math.random()` only returns Double values.

Expand Down Expand Up @@ -48,7 +48,7 @@ Second randomValue: 0.9664240431908591
<br>
### 2. Using java.util.Random Class

The `java.util.Random` is really handy. It provides methods such as `nextInt()`, `nextDouble()`, `nextLong()` and `nextFloat()` to generate random values of different types.
The [`java.util.Random`](https://docs.oracle.com/javase/8/docs/api/java/util/Random.html) is really handy. It provides methods such as `nextInt()`, `nextDouble()`, `nextLong()` and `nextFloat()` to generate random values of different types.

When you invoke one of these methods, you will get a Number between 0 and the given parameter (the value given as the parameter itself is excluded).

Expand Down Expand Up @@ -94,7 +94,7 @@ Second double: 0.42704069834866554

This class was added in Java 1.7, so hopefully you can use it.

`ThreadLocalRandom` is similar to the previous approach and defines methods such as `nextInt()` or `nextDouble()`. In fact, it is just a small change to the previously used `Random`. See for yourself:
[`ThreadLocalRandom`](https://docs.oracle.com/javase/8/docs/api/java/util/concurrent/ThreadLocalRandom.html) is similar to the previous approach and defines methods such as `nextInt()` or `nextDouble()`. In fact, it is just a small change to the previously used `Random`. See for yourself:

```java
import java.util.concurrent.ThreadLocalRandom;
Expand Down Expand Up @@ -134,7 +134,7 @@ Second double: 0.7118640850137595
<br>
### 4. Using java.security.SecureRandom

The previous solutions are using pseudo-random numbers. This one here is a `cryptographically strong random number generator`.
The previous solutions are using pseudo-random numbers. This one here is a `cryptographically strong random number generator` see the JavaDocs of [SecureRandom](https://docs.oracle.com/javase/8/docs/api/java/security/SecureRandom.html).

The implementation only differs slightly from the ones before. Frankly speaking, it is a drop-in replacement for `Random`:

Expand Down
87 changes: 87 additions & 0 deletions _posts/2020-01-11-starting-into-new-decade-software-engineer.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,87 @@
---
layout: post
title: "Starting Into the New Decade - Software Engineer's Edition"
bigimg: /img/content/new-year-2020_title.jpg
share-img: https://programmerfriend.com/img/content/new-year-2020_title.jpg
tags: [new-year, developers]
---

First of all, I don't want to get too technical about the start and end of decades.
Personally, I would prefer the decade to had ended in 2019; yet I think 2020/12/31 will be the end of the current decade.

Anyway, since I already explained that the title is technically incorrect - what else can we expect from this article?

More or less the article is a personal one, I want to reflect on what happened last year and compare it with what I expected before.
Luckily, I wrote a similar article at the beginning of last year [Year++ - A Software Engineer’s New Year’s Resolutions](../_site/year-a-software-engineers-new-years-resolutions).

The second part of the article is about the things I intend to do this year. Let's see how all of this ends.

## 2019s resolutions

My last year's resolutions were:
* Writing 50 blog posts
* Learn Android (Kotlin)
* Improve the Stability of the Backend I was working on
* Extend my Knowledge of Backend Technologies

Ok, let's check if I did even achieve anything of these.

**Writing 50 blog posts**: The resolution I actually remembered and already knew before checking that I would be missing a few posts.
I wrote **24** blog posts last year. I knew I would be short - but I am still quite satisfied with the actual count.

Writing those posts was more work than I initially expected. I have to stay at it in order to reach a similar count next year.

**Learn Android (Kotlin)**

In a conversation, this would be when you try to avoid eye-contact. Obviously, I didn't put too much pressure on this. In the first quarter of the year, I learned the Android Basics using Java in my spare time. Since then I didn't use any of that knowledge.

When it comes to Kotlin it looks a bit better. At work, we had a 3-month exploration. The Backend was a Kotlin Spring Boot service.
For the current product I am working on, Kotlin is used for several services.

**Improve the Stability of the Backend**

I would count this a success: Despite leaving my old project earlier than expected, I still could use the time I had to improve the stability together with my colleagues. My latest tasks were the foundation for further improvements.

**Extend my Knowledge of Backend Technologies**
Looking back, this worked pretty well. Joining the new product allowed me to get in contact with technologies that were new to me.
To name a few: Keycloak, Postgres, Kubernetes, Azure.

### Recap of 2019s resolutions
I didn't reach all my goals. But what did I do instead?

With the new product, there were new personal challenges.

A big part of the initial effort was to migrate the existing project to a new team. I also was the first developer of that new team.

One of my occupations was to staff the new team. I didn't have the freedom that I was expecting still, I am more than satisfied with the final outcome. I think we have a really good team that can throw at all problems that come along.
Even after the team staffing was completed, I participated in a lot of interviews for future candidates.

Instead of learning Android, I had a good refresh on the basics of [React](https://reactjs.org/), one of the most popular JavaScript Web Frameworks. I expect that I can further deepen that knowledge during the next year.

So much for 2019 - what will 2020 have in store for me?

## New Year Resolutions for 2020

I enjoy writing for Programmerfriend.com, I definitely want to keep it going. I don't want to commit to a number here, but I realized I need to create a schedule for writing blog posts. Let's commit to writing at least **the same amount of posts as in the previous year**.

When giving advice to others, I always stress to get out of the comfort zone. I also want to do this to myself and therefore will try to **get into some kind of public speaking**. I'm not yet settled on the way I want to tackle this in detail, but we will see.

Still out of my comfort zone: I want to start my own things. Programmerfriend is really awesome, but I think it could be the time to **start something on my own, a side-hustle to my daily 9 to 5**. I still don't have any clue but I am pretty sure I will come up with something during the next few months.

Lately, I realized that my typing became a bit bad. I measured it and it seems that I max out at around 70 words per minute. It is not only the speed but I would love to switch back to using more than 4 to 6 fingers for it. If it is not for the speed, I would love to do it for ergonomics and convenience. This year I want to go back to **Touch typing** with higher accuracy.

When it comes to my current work, I am pretty satisfied with how everything works out right now. Things I would like to improve are:
* **Meeting efficiency**: Replace meetings by e-mails when possible.
* **Continue to work on the project/team**: Instead of just writing code, I got a lot of tasks that require me to go beyond that.
I am a technical person but I am not just someone who writes code. I love to improve the whole Development process where possible.
No matter if it is about Testing, CI/CD or talking to product owners or architects when thinking about the next features we want to implement.
* **Network at Work**: I still have the feeling that at work I have a limited view over all the aspects. Therefore I would like to reach out to colleagues who are working on other projects in my business unit.
* **Help where Help is needed/wanted**: In my opinion, the company as such or at least the business unit is facing a rough time. I would really like to help outside of my current scope where possible. Let's see if I get the opportunity to do so.

## Recap

We talked a lot about the past, today and the near future.
This article focused on me, but how about you?
What are your new year resolutions for 2020?

I really would love to hear them. Either here as a comment or on Twitter <a href="https://twitter.com/intent/tweet?screen_name=eiselems&ref_src=twsrc%5Etfw" class="twitter-mention-button" data-size="large" data-text="My new year resolution for 2020 is ... #programmerfriend #newYearResolution" data-related="eiselems" data-show-count="false">Tweet to @eiselems</a><script async src="https://platform.twitter.com/widgets.js" charset="utf-8"></script>.

0 comments on commit f0e85f3

Please sign in to comment.